models

package
v1.16.1-alpha Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 17, 2026 License: MIT Imports: 38 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OnboardingStepProfile = 0
	OnboardingStepSocial  = 1
	OnboardingStepKeys    = 2
	OnboardingStepRepo    = 3
	OnboardingStepDone    = 4
)

onboarding steps, in order. Done is a sentinel that marks completion.

Variables

View Source
var (
	LabelNoOpError = errors.New("no-op")
)
View Source
var OrderedReactionKinds = []ReactionKind{
	Like,
	Unlike,
	Laugh,
	Celebration,
	Confused,
	Heart,
	Rocket,
	Eyes,
}
View Source
var SocialNotificationTypes = []NotificationType{
	NotificationTypeRepoStarred,
	NotificationTypeFollowed,
}

Functions

func AsIssueStateRecord

func AsIssueStateRecord(subject syntax.ATURI, value StateValue, createdAt time.Time) (tangled.RepoIssueState, error)

func AsPullStatusRecords

func AsPullStatusRecords(subjects []syntax.ATURI, value StateValue, createdAt time.Time) ([]tangled.RepoPullStatus, error)

func LabelOpsAsRecord

func LabelOpsAsRecord(ops []LabelOp) tangled.LabelOp

func NormalizeReactionSubject

func NormalizeReactionSubject(subject syntax.ATURI) syntax.ATURI

func StripGitExt

func StripGitExt(name string) string

func ValidateRepoName

func ValidateRepoName(name string) error

Types

type Artifact

type Artifact struct {
	Id   uint64
	Did  string
	Rkey string

	RepoDid   syntax.DID
	Tag       plumbing.Hash
	CreatedAt time.Time

	BlobCid  cid.Cid
	Name     string
	Size     uint64
	MimeType string
}

func (*Artifact) ArtifactAt

func (a *Artifact) ArtifactAt() syntax.ATURI

type AspectRatio

type AspectRatio struct {
	Width  int64 `json:"width"`
	Height int64 `json:"height"`
}

type BlobContentType

type BlobContentType int
const (
	BlobContentTypeCode BlobContentType = iota
	BlobContentTypeMarkup
	BlobContentTypeImage
	BlobContentTypeSvg
	BlobContentTypeVideo
	BlobContentTypeSubmodule
	BlobContentTypeOther
)

func (BlobContentType) HasRawView

func (ty BlobContentType) HasRawView() bool

func (BlobContentType) HasRenderedView

func (ty BlobContentType) HasRenderedView() bool

func (BlobContentType) HasTextView

func (ty BlobContentType) HasTextView() bool

func (BlobContentType) IsCode

func (ty BlobContentType) IsCode() bool

func (BlobContentType) IsImage

func (ty BlobContentType) IsImage() bool

func (BlobContentType) IsMarkup

func (ty BlobContentType) IsMarkup() bool

func (BlobContentType) IsSubmodule

func (ty BlobContentType) IsSubmodule() bool

func (BlobContentType) IsSvg

func (ty BlobContentType) IsSvg() bool

func (BlobContentType) IsVideo

func (ty BlobContentType) IsVideo() bool

type BlobView

type BlobView struct {
	// content type flags
	ContentType BlobContentType

	// Content data
	ContentSrc   string // URL to raw content
	Contents     string // textual content
	FileTooLarge bool   // textual content is too large
	Lines        int    // line count of textual content
	SizeHint     uint64
}

type BranchDeleteStatus

type BranchDeleteStatus struct {
	Repo   *Repo
	Branch string
}

type BskyPost

type BskyPost struct {
	AuthorDid   string
	Rkey        string
	Text        string
	CreatedAt   time.Time
	Langs       []string
	Tags        []string
	Embed       *PostEmbed
	Facets      json.RawMessage
	LikeCount   int64
	ReplyCount  int64
	RepostCount int64
	QuoteCount  int64
}

type ByMonth

type ByMonth struct {
	Commits     int
	RepoEvents  []RepoEvent
	IssueEvents IssueEvents
	PullEvents  PullEvents
}

func (ByMonth) IsEmpty

func (b ByMonth) IsEmpty() bool

type Collaborator

type Collaborator struct {
	// identifiers for the record
	Id   int64
	Did  syntax.DID
	Rkey sql.NullString

	// content
	SubjectDid syntax.DID
	RepoDid    syntax.DID

	// meta
	Created time.Time
}

type Comment

type Comment struct {
	Id int64

	Did        syntax.DID
	Collection syntax.NSID
	Rkey       syntax.RecordKey
	Cid        syntax.CID

	// record content
	Subject      comatproto.RepoStrongRef
	Body         tangled.MarkupMarkdown // markup body type. only markdown is supported right now
	Created      time.Time
	ReplyTo      *comatproto.RepoStrongRef // (optional) parent comment
	PullRoundIdx *int                      // (optional) pull round number used when subject is sh.tangled.repo.pull

	// store on db, but not on PDS
	Edited  *time.Time
	Deleted *time.Time
}

func CommentFromRecord

func CommentFromRecord(did syntax.DID, rkey syntax.RecordKey, cid syntax.CID, record tangled.FeedComment) (*Comment, error)

func (Comment) AsRecord

func (c Comment) AsRecord() typegen.CBORMarshaler

func (Comment) AtUri

func (c Comment) AtUri() syntax.ATURI

func (Comment) EditableBody

func (c Comment) EditableBody() string

func (Comment) FeedCommentAtUri

func (c Comment) FeedCommentAtUri() syntax.ATURI

force-return the feed.comment NSID

func (Comment) IsLegacy

func (c Comment) IsLegacy() bool

func (*Comment) IsReply

func (c *Comment) IsReply() bool

func (*Comment) IsTopLevel

func (c *Comment) IsTopLevel() bool

func (Comment) StrongRef

func (c Comment) StrongRef() comatproto.RepoStrongRef

func (*Comment) Validate

func (c *Comment) Validate() error

type CommentListItem

type CommentListItem struct {
	Self    *Comment
	Replies []*Comment
}

func NewCommentList

func NewCommentList(comments []Comment) []CommentListItem

func (*CommentListItem) Participants

func (it *CommentListItem) Participants() []syntax.DID

type ConcreteType

type ConcreteType string
const (
	ConcreteTypeNull   ConcreteType = "null"
	ConcreteTypeString ConcreteType = "string"
	ConcreteTypeInt    ConcreteType = "integer"
	ConcreteTypeBool   ConcreteType = "boolean"
)

type DomainClaim

type DomainClaim struct {
	ID      int64
	Did     string
	Domain  string
	Deleted *time.Time
}

type Email

type Email struct {
	ID               int64
	Did              string
	Address          string
	Verified         bool
	Primary          bool
	VerificationCode string
	LastSent         *time.Time
	CreatedAt        time.Time
}

type Follow

type Follow struct {
	UserDid    string
	SubjectDid string
	FollowedAt time.Time
	Rkey       string
}

func (*Follow) AsRecord

func (f *Follow) AsRecord() tangled.GraphFollow

type FollowStats

type FollowStats struct {
	Followers int64
	Following int64
}

type FollowStatus

type FollowStatus int
const (
	IsNotFollowing FollowStatus = iota
	IsFollowing
	IsSelf
)

func (FollowStatus) String

func (s FollowStatus) String() string

type InflightSignup

type InflightSignup struct {
	Id         int64
	Email      string
	InviteCode string
	Created    time.Time
}

type Issue

type Issue struct {
	Id         int64
	Did        string
	Rkey       string
	RepoDid    syntax.DID
	IssueId    int
	Created    time.Time
	Edited     *time.Time
	Deleted    *time.Time
	Title      string
	Body       string
	Open       bool
	Mentions   []syntax.DID
	References []syntax.ATURI

	// optionally, populate this when querying for reverse mappings
	// like comment counts, parent repo etc.
	Comments []Comment
	Labels   LabelState
	Repo     *Repo
}

func IssueFromRecord

func IssueFromRecord(did, rkey string, record tangled.RepoIssue) Issue

func (*Issue) AsRecord

func (i *Issue) AsRecord() tangled.RepoIssue

func (*Issue) AtUri

func (i *Issue) AtUri() syntax.ATURI

func (*Issue) Participants

func (i *Issue) Participants() []syntax.DID

func (*Issue) State

func (i *Issue) State() string

func (*Issue) Validate

func (i *Issue) Validate() error

type IssueCount

type IssueCount struct {
	Open   int
	Closed int
}

type IssueEventStats

type IssueEventStats struct {
	Open   int
	Closed int
}

type IssueEvents

type IssueEvents struct {
	Items []*Issue
}

func (IssueEvents) Stats

func (i IssueEvents) Stats() IssueEventStats

type IssueSearchOptions

type IssueSearchOptions struct {
	Keywords    []string
	Phrases     []string
	RepoDid     string
	IsOpen      *bool
	AuthorDid   string
	Labels      []string
	LabelValues []string

	NegatedKeywords    []string
	NegatedPhrases     []string
	NegatedLabels      []string
	NegatedLabelValues []string
	NegatedAuthorDids  []string

	Page pagination.Page
}

func (*IssueSearchOptions) HasSearchFilters

func (o *IssueSearchOptions) HasSearchFilters() bool

type KnotMember

type KnotMember struct {
	Id      int64
	Did     syntax.DID
	Rkey    string
	Domain  string
	Subject syntax.DID
	Created time.Time
}

type LabelApplicationCtx

type LabelApplicationCtx struct {
	Defs map[string]*LabelDefinition // labelAt -> labelDef
}

func (*LabelApplicationCtx) ApplyLabelOp

func (c *LabelApplicationCtx) ApplyLabelOp(state LabelState, op LabelOp) error

func (*LabelApplicationCtx) ApplyLabelOps

func (c *LabelApplicationCtx) ApplyLabelOps(state LabelState, ops []LabelOp)

type LabelDefinition

type LabelDefinition struct {
	Id   int64
	Did  string
	Rkey string

	Name      string
	ValueType ValueType
	Scope     []string
	Color     *string
	Multiple  bool
	Created   time.Time
}

func FetchLabelDefs

func FetchLabelDefs(r *idresolver.Resolver, aturis []string) ([]LabelDefinition, error)

func LabelDefinitionFromRecord

func LabelDefinitionFromRecord(did, rkey string, record tangled.LabelDefinition) (*LabelDefinition, error)

func (*LabelDefinition) AsRecord

func (l *LabelDefinition) AsRecord() tangled.LabelDefinition

func (*LabelDefinition) AtUri

func (l *LabelDefinition) AtUri() syntax.ATURI

func (LabelDefinition) GetColor

func (l LabelDefinition) GetColor() string

func (*LabelDefinition) Validate

func (l *LabelDefinition) Validate() error

func (*LabelDefinition) ValidateOperandValue

func (def *LabelDefinition) ValidateOperandValue(op *LabelOp) error

ValidateOperandValue validates the label operation operand value based on label definition.

NOTE: This can modify the LabelOp

type LabelOp

type LabelOp struct {
	Id           int64
	Did          string
	Rkey         string
	Subject      syntax.ATURI
	Operation    LabelOperation
	OperandKey   string
	OperandValue string
	PerformedAt  time.Time
}

func LabelOpsFromRecord

func LabelOpsFromRecord(did, rkey string, record tangled.LabelOp) []LabelOp

a record can create multiple label ops

func ReduceLabelOps

func ReduceLabelOps(ops []LabelOp) []LabelOp

removes pairs of label operations that are inverses of each other from the given slice. the function preserves the order of remaining operations.

func (LabelOp) IsInverse

func (op1 LabelOp) IsInverse(op2 LabelOp) bool

IsInverse checks if one label operation is the inverse of another returns true if one is an add and the other is a delete with the same key and value

func (LabelOp) SortAt

func (l LabelOp) SortAt() time.Time

func (*LabelOp) Validate

func (l *LabelOp) Validate() error

type LabelOperation

type LabelOperation string
const (
	LabelOperationAdd LabelOperation = "add"
	LabelOperationDel LabelOperation = "del"
)

type LabelState

type LabelState struct {
	// contains filtered or unexported fields
}

func NewLabelState

func NewLabelState() LabelState

func (LabelState) ContainsLabel

func (s LabelState) ContainsLabel(l string) bool

func (LabelState) ContainsLabelAndVal

func (s LabelState) ContainsLabelAndVal(l, v string) bool

go maps behavior in templates make this necessary, indexing a map and getting `set` in return is apparently truthy

func (LabelState) GetValSet

func (s LabelState) GetValSet(l string) set

func (LabelState) Inner

func (s LabelState) Inner() map[string]set

func (LabelState) LabelNameValues

func (s LabelState) LabelNameValues() []string

LabelNameValues returns composite "name:value" strings for all labels that have non-empty values.

func (LabelState) LabelNames

func (s LabelState) LabelNames() []string

func (LabelState) SetName

func (s LabelState) SetName(key, name string)

type Notification

type Notification struct {
	ID           int64
	RecipientDid string
	ActorDid     string
	Type         NotificationType
	EntityType   string
	EntityId     string
	Read         bool
	Created      time.Time

	// foreign key references
	RepoId  *int64
	IssueId *int64
	PullId  *int64
}

func (*Notification) Icon

func (n *Notification) Icon() string

lucide icon that represents this notification

type NotificationPreferences

type NotificationPreferences struct {
	ID                 int64
	UserDid            syntax.DID
	RepoStarred        bool
	IssueCreated       bool
	IssueCommented     bool
	PullCreated        bool
	PullCommented      bool
	Followed           bool
	UserMentioned      bool
	PullMerged         bool
	IssueClosed        bool
	EmailNotifications bool
}

func DefaultNotificationPreferences

func DefaultNotificationPreferences(user syntax.DID) *NotificationPreferences

func (*NotificationPreferences) ShouldNotify

func (prefs *NotificationPreferences) ShouldNotify(t NotificationType) bool

type NotificationType

type NotificationType string
const (
	NotificationTypeRepoStarred     NotificationType = "repo_starred"
	NotificationTypeIssueCreated    NotificationType = "issue_created"
	NotificationTypeIssueCommented  NotificationType = "issue_commented"
	NotificationTypePullCreated     NotificationType = "pull_created"
	NotificationTypePullCommented   NotificationType = "pull_commented"
	NotificationTypeFollowed        NotificationType = "followed"
	NotificationTypePullMerged      NotificationType = "pull_merged"
	NotificationTypeIssueClosed     NotificationType = "issue_closed"
	NotificationTypeIssueReopen     NotificationType = "issue_reopen"
	NotificationTypePullClosed      NotificationType = "pull_closed"
	NotificationTypePullReopen      NotificationType = "pull_reopen"
	NotificationTypeUserMentioned   NotificationType = "user_mentioned"
	NotificationTypeIssueAssigned   NotificationType = "issue_assigned"
	NotificationTypeIssueUnassigned NotificationType = "issue_unassigned"
	NotificationTypePullAssigned    NotificationType = "pull_assigned"
	NotificationTypePullUnassigned  NotificationType = "pull_unassigned"
)

type NotificationWithEntity

type NotificationWithEntity struct {
	*Notification
	Repo  *Repo
	Issue *Issue
	Pull  *Pull
}

func (*NotificationWithEntity) URL

URL returns the navigable path for the notification, resolving DIDs to handles via the provided resolver.

type Onboarding

type Onboarding struct {
	Did     string
	Step    int
	Status  OnboardingStatus
	Created time.Time
	Updated time.Time
}

func (*Onboarding) Progress

func (o *Onboarding) Progress() OnboardingProgress

Progress derives display progress for the resume banner/panel. It is nil-safe, so callers can pass the result of GetOnboarding directly.

type OnboardingProgress

type OnboardingProgress struct {
	Active  bool
	Step    int
	Total   int
	Percent int
}

OnboardingProgress feeds the "resume onboarding" banner/panel. Active is false when there is nothing to resume (no in-progress onboarding).

type OnboardingStatus

type OnboardingStatus string
const (
	OnboardingInProgress OnboardingStatus = "in_progress"
	OnboardingCompleted  OnboardingStatus = "completed"
	OnboardingSkipped    OnboardingStatus = "skipped"
)

type PDSMigration

type PDSMigration struct {
	Name       string           // name of the migration
	Did        syntax.DID       // record owner
	Collection syntax.NSID      // record collection
	Rkey       syntax.RecordKey // record rkey
	Status     PDSMigrationStatus
	ErrorMsg   *string // error message from previous attempt
	RetryCount int
	RetryAfter int64 // Unix timestamp (seconds)
}

func (*PDSMigration) RecordAtUri

func (m *PDSMigration) RecordAtUri() syntax.ATURI

type PDSMigrationStatus

type PDSMigrationStatus string
const (
	PDSMigrationStatusPending PDSMigrationStatus = "pending"
	PDSMigrationStatusRunning PDSMigrationStatus = "running"
	PDSMigrationStatusDone    PDSMigrationStatus = "done"
	PDSMigrationStatusFailed  PDSMigrationStatus = "failed"
)

type PDSRecordMigration

type PDSRecordMigration struct {
	Did      syntax.DID
	Name     string         // name of the migration
	Records  []syntax.ATURI // records that need a migration
	ErrorMsg *string        // error message from previous attempt
}

type Pipeline

type Pipeline struct {
	Id        int
	Rkey      string
	Knot      string
	RepoOwner syntax.DID
	RepoName  string
	RepoDid   string
	TriggerId int
	Sha       string
	Created   time.Time

	// populate when querying for reverse mappings
	Trigger  *Trigger
	Statuses map[string]WorkflowStatus
}

func (*Pipeline) AtUri

func (p *Pipeline) AtUri() syntax.ATURI

func (Pipeline) Counts

func (p Pipeline) Counts() map[string]int

func (Pipeline) IsResponding

func (p Pipeline) IsResponding() bool

if we know that a spindle has picked up this pipeline, then it is Responding

func (Pipeline) LongStatusSummary

func (p Pipeline) LongStatusSummary() string

produces a string of the form "3/4 success, 2/4 failed, 1/4 pending"

func (Pipeline) ShortStatusSummary

func (p Pipeline) ShortStatusSummary() string

produces short summary of successes: - "0/4" when zero successes of 4 workflows - "4/4" when all successes of 4 workflows - "0/0" when no workflows run in this pipeline

func (Pipeline) TimeTaken

func (p Pipeline) TimeTaken() time.Duration

func (Pipeline) Workflows

func (p Pipeline) Workflows() []string

type PipelineStatus

type PipelineStatus struct {
	ID           int
	Spindle      string
	Rkey         string
	PipelineKnot string
	PipelineRkey string
	Created      time.Time
	Workflow     string
	Status       spindle.StatusKind
	Error        *string
	ExitCode     int
}

func (PipelineStatus) ErrorDetails

func (ps PipelineStatus) ErrorDetails() string

func (PipelineStatus) ErrorMessage

func (ps PipelineStatus) ErrorMessage() string

func (*PipelineStatus) PipelineAt

func (ps *PipelineStatus) PipelineAt() syntax.ATURI

type PostEmbed

type PostEmbed struct {
	Images   []PostImage   `json:"images,omitempty"`
	External *PostExternal `json:"external,omitempty"`
	Video    *PostVideo    `json:"video,omitempty"`
}

type PostExternal

type PostExternal struct {
	Uri         string `json:"uri"`
	Title       string `json:"title"`
	Description string `json:"description"`
	Thumb       string `json:"thumb"`
}

type PostImage

type PostImage struct {
	Fullsize    string       `json:"fullsize"`
	Thumb       string       `json:"thumb"`
	Alt         string       `json:"alt"`
	AspectRatio *AspectRatio `json:"aspectRatio,omitempty"`
}

type PostVideo

type PostVideo struct {
	Playlist  string `json:"playlist"`
	Thumbnail string `json:"thumbnail"`
	Alt       string `json:"alt"`
}

type Profile

type Profile struct {
	// ids
	ID  int
	Did string

	// data
	Avatar          string // CID of the avatar blob
	Description     string
	IncludeBluesky  bool
	Location        string
	Links           [5]string
	Stats           [2]VanityStat
	PinnedRepos     [6]string
	Pronouns        string
	PreferredHandle syntax.Handle
}

func (Profile) IsLinksEmpty

func (p Profile) IsLinksEmpty() bool

func (Profile) IsPinnedReposEmpty

func (p Profile) IsPinnedReposEmpty() bool

func (Profile) IsStatsEmpty

func (p Profile) IsStatsEmpty() bool

func (Profile) MatchesPinnedRepo

func (p Profile) MatchesPinnedRepo(repo Repo) bool

func (*Profile) ProfileAt

func (p *Profile) ProfileAt() syntax.ATURI

type ProfileTimeline

type ProfileTimeline struct {
	ByMonth []ByMonth
}

func (*ProfileTimeline) IsEmpty

func (p *ProfileTimeline) IsEmpty() bool

type PublicKey

type PublicKey struct {
	Did     string `json:"did"`
	Key     string `json:"key"`
	Name    string `json:"name"`
	Rkey    string `json:"rkey"`
	Created *time.Time
}

func PublicKeyFromRecord

func PublicKeyFromRecord(did syntax.DID, rkey syntax.RecordKey, record tangled.PublicKey) (PublicKey, error)

func (*PublicKey) AsRecord

func (p *PublicKey) AsRecord() tangled.PublicKey

func (PublicKey) MarshalJSON

func (p PublicKey) MarshalJSON() ([]byte, error)

func (*PublicKey) Validate

func (p *PublicKey) Validate() error

type Pull

type Pull struct {
	// ids
	ID     int
	PullId int

	// at ids
	RepoDid  syntax.DID
	OwnerDid string
	Rkey     string

	// content
	Title        string
	Body         string
	TargetBranch string
	State        PullState
	Submissions  []*PullSubmission
	Mentions     []syntax.DID
	References   []syntax.ATURI

	// stacking
	DependentOn *syntax.ATURI

	// meta
	Created    time.Time
	PullSource *PullSource

	// optionally, populate this when querying for reverse mappings
	Labels LabelState
	Repo   *Repo
}

func PullFromRecord

func PullFromRecord(did, rkey string, record tangled.RepoPull, blobs []io.Reader) (*Pull, error)

func (Pull) AsRecord

func (p Pull) AsRecord() tangled.RepoPull

NOTE: This method does not include patch blob in returned atproto record

func (*Pull) AtUri

func (p *Pull) AtUri() syntax.ATURI

func (*Pull) IsBranchBased

func (p *Pull) IsBranchBased() bool

func (*Pull) IsForkBased

func (p *Pull) IsForkBased() bool

func (*Pull) IsPatchBased

func (p *Pull) IsPatchBased() bool

func (*Pull) LastRoundNumber

func (p *Pull) LastRoundNumber() int

func (*Pull) LatestPatch

func (p *Pull) LatestPatch() string

func (*Pull) LatestSha

func (p *Pull) LatestSha() string

func (*Pull) LatestSubmission

func (p *Pull) LatestSubmission() *PullSubmission

func (*Pull) Participants

func (p *Pull) Participants() []syntax.DID

func (*Pull) TotalComments

func (p *Pull) TotalComments() int

func (*Pull) Validate

func (pull *Pull) Validate() error

type PullCount

type PullCount struct {
	Open    int
	Merged  int
	Closed  int
	Deleted int
}

type PullEventStats

type PullEventStats struct {
	Closed int
	Open   int
	Merged int
}

type PullEvents

type PullEvents struct {
	Items []*Pull
}

func (PullEvents) Stats

func (p PullEvents) Stats() PullEventStats

type PullSearchOptions

type PullSearchOptions struct {
	Keywords    []string
	Phrases     []string
	RepoDid     string
	State       *PullState
	AuthorDid   string
	Labels      []string
	LabelValues []string

	NegatedKeywords    []string
	NegatedPhrases     []string
	NegatedLabels      []string
	NegatedLabelValues []string
	NegatedAuthorDids  []string

	Page pagination.Page
}

func (*PullSearchOptions) HasSearchFilters

func (o *PullSearchOptions) HasSearchFilters() bool

type PullSource

type PullSource struct {
	Branch  string
	RepoDid *syntax.DID

	// optionally populate this for reverse mappings
	Repo *Repo
}

func (*PullSource) AsRecord

func (s *PullSource) AsRecord() *tangled.RepoPull_Source

type PullState

type PullState int
const (
	PullClosed PullState = iota
	PullOpen
	PullMerged
	PullAbandoned
)

func (PullState) IsAbandoned

func (p PullState) IsAbandoned() bool

func (PullState) IsClosed

func (p PullState) IsClosed() bool

func (PullState) IsMerged

func (p PullState) IsMerged() bool

func (PullState) IsOpen

func (p PullState) IsOpen() bool

func (PullState) String

func (p PullState) String() string

type PullSubmission

type PullSubmission struct {
	// ids
	ID int

	// at ids
	PullAt syntax.ATURI

	// content
	RoundNumber int
	Blob        lexutil.LexBlob
	Patch       string
	Combined    string
	Comments    []Comment
	SourceRev   string // include the rev that was used to create this submission: only for branch/fork PRs

	// meta
	Created time.Time
}

func PullSubmissionFromRecord

func PullSubmissionFromRecord(did, rkey string, roundNumber int, round *tangled.RepoPull_Round, blob io.Reader) (*PullSubmission, error)

func (PullSubmission) AsFormatPatch

func (s PullSubmission) AsFormatPatch() []types.FormatPatch

func (*PullSubmission) AsRecord

func (s *PullSubmission) AsRecord() *tangled.RepoPull_Round

func (PullSubmission) ChangeId

func (s PullSubmission) ChangeId() string

empty if invalid, not otherwise

func (PullSubmission) CombinedPatch

func (s PullSubmission) CombinedPatch() string

func (*PullSubmission) GetBlob

func (s *PullSubmission) GetBlob() *lexutil.LexBlob

func (PullSubmission) IsFormatPatch

func (s PullSubmission) IsFormatPatch() bool

func (*PullSubmission) Participants

func (s *PullSubmission) Participants() []string

type Punch

type Punch struct {
	Did   string
	Date  time.Time
	Count int
}

type Punchcard

type Punchcard struct {
	Total   int
	Punches []Punch
}

type PunchcardPreference

type PunchcardPreference struct {
	ID         int
	Did        string
	HideMine   bool
	HideOthers bool
}

type Reaction

type Reaction struct {
	ReactedByDid string
	ThreadAt     syntax.ATURI
	Created      time.Time
	Rkey         string
	Kind         ReactionKind
}

func (*Reaction) AsRecord

func (r *Reaction) AsRecord() tangled.FeedReaction

type ReactionDisplayData

type ReactionDisplayData struct {
	Count int
	Users []string
}

type ReactionKind

type ReactionKind string
const (
	Like        ReactionKind = "👍"
	Unlike      ReactionKind = "👎"
	Laugh       ReactionKind = "😆"
	Celebration ReactionKind = "🎉"
	Confused    ReactionKind = "🫤"
	Heart       ReactionKind = "❤️"
	Rocket      ReactionKind = "🚀"
	Eyes        ReactionKind = "👀"
)

func ParseReactionKind

func ParseReactionKind(raw string) (ReactionKind, bool)

func (ReactionKind) String

func (rk ReactionKind) String() string
type RecentLink struct {
	Id       int64
	UserDid  string
	LinkType RecentLinkType
	Target   string // repo DID for repos; AT-URI string for issues/pulls
	Visited  time.Time
}

type RecentLinkType

type RecentLinkType string
const (
	RecentLinkTypeRepo  RecentLinkType = "repo"
	RecentLinkTypeIssue RecentLinkType = "issue"
	RecentLinkTypePull  RecentLinkType = "pull"
)

type RefKind

type RefKind int
const (
	RefKindIssue RefKind = iota
	RefKindPull
)

func (RefKind) String

func (k RefKind) String() string
type ReferenceLink struct {
	Handle      string
	Repo        string
	Kind        RefKind
	SubjectId   int
	CommentRkey *syntax.RecordKey
}

/@alice.com/cool-proj/issues/123 /@alice.com/cool-proj/issues/123#comment-3mleetx5lhz22

type Registration

type Registration struct {
	Id           int64
	Domain       string
	ByDid        string
	Created      *time.Time
	Registered   *time.Time
	NeedsUpgrade bool
}

Registration represents a knot registration. Knot would've been a better name but we're stuck with this for historical reasons.

func (*Registration) IsNeedsUpgrade

func (r *Registration) IsNeedsUpgrade() bool

func (*Registration) IsPending

func (r *Registration) IsPending() bool

func (*Registration) IsRegistered

func (r *Registration) IsRegistered() bool

func (*Registration) Status

func (r *Registration) Status() Status

type Repo

type Repo struct {
	Id          int64
	Did         string
	Name        string
	Knot        string
	Rkey        string
	Created     time.Time
	Description string
	Website     string
	Topics      []string
	Spindle     string
	Labels      []string
	RepoDid     string

	// optionally, populate this when querying for reverse mappings
	RepoStats *RepoStats

	// optional
	Source string
}

func (*Repo) AsRecord

func (r *Repo) AsRecord() tangled.Repo

func (Repo) PinIdentifier

func (r Repo) PinIdentifier() string

func (Repo) RepoAt

func (r Repo) RepoAt() syntax.ATURI

func (Repo) RepoDidPtr

func (r Repo) RepoDidPtr() *string

func (Repo) RepoIdentifier

func (r Repo) RepoIdentifier() string

func (Repo) Slug

func (r Repo) Slug() string

func (Repo) TopicStr

func (r Repo) TopicStr() string

type RepoEvent

type RepoEvent struct {
	Repo   *Repo
	Source *Repo
}

type RepoGroup

type RepoGroup struct {
	Repo   *Repo
	Issues []Issue
}

type RepoLabel

type RepoLabel struct {
	Id      int64
	RepoDid syntax.DID
	LabelAt syntax.ATURI
}

type RepoLanguage

type RepoLanguage struct {
	Id           int64
	RepoDid      syntax.DID
	Ref          string
	IsDefaultRef bool
	Language     string
	Bytes        int64
}

type RepoSearchOptions

type RepoSearchOptions struct {
	Keywords []string // text search across name, description, website, topics
	Phrases  []string // phrase search

	Language string   // exact match on primary language
	Knot     string   // filter by knot domain
	Did      string   // filter by owner DID
	Topics   []string // exact topic matches

	NegatedKeywords []string
	NegatedPhrases  []string
	NegatedTopics   []string

	// Sort configuration
	SortField string
	SortDesc  bool

	Page pagination.Page
}

func (*RepoSearchOptions) HasSearchFilters

func (o *RepoSearchOptions) HasSearchFilters() bool

type RepoSite

type RepoSite struct {
	ID       int64
	RepoDid  syntax.DID
	RepoRkey string // populated when joined with repos table
	Branch   string
	Dir      string
	IsIndex  bool
	Created  time.Time
	Updated  time.Time
}

type RepoStar

type RepoStar struct {
	Star
	Repo *Repo
}

RepoStar is used for reverse mapping to repos

type RepoStats

type RepoStats struct {
	Language   string
	StarCount  int
	IssueCount IssueCount
	PullCount  PullCount
	ForkCount  int
}

func (*RepoStats) LangShortName

func (s *RepoStats) LangShortName() string

returns the first file extension for the language ("ts" for typescript) as an uppercase string

type Result

type Result struct {
	RepoDID  syntax.DID
	FilePath string
	Branches []string // branch names
	Commit   string   // commit id
	Language string

	File   *Result_FileMatch   // set for a filename match
	Chunks []Result_ChunkMatch // set for content matches
}

Result is a single matched file. A zoekt FileMatch is either a filename match or a set of content matches, never both: File is set for the former, Chunks for the latter.

func (*Result) IsChunkMatch

func (r *Result) IsChunkMatch() bool

IsChunkMatch tells if search result is from chunk match

func (*Result) IsFileMatch

func (r *Result) IsFileMatch() bool

IsFileMatch tells if search result is from file-name match

type Result_ChunkMatch

type Result_ChunkMatch struct {
	// Content is a contiguous run of complete lines that fully contains Ranges.
	Content string
	// ContentStartLine is the 1-based line number of Content's first line.
	ContentStartLine int
	// Ranges are the matched span(s) within the file. LineNumber/Column are
	// 1-based, Column is in runes. A Range may span multiple lines.
	Ranges []zoekt.Range
}

type Result_FileMatch

type Result_FileMatch struct {
	// Ranges are the matched span(s) within FilePath. LineNumber is always 1 for
	// filename matches; Column is 1-based and in runes.
	Ranges []zoekt.Range
}
type RichReferenceLink struct {
	ReferenceLink
	Title string
	// reusing PullState for both issue & PR
	State PullState
}

type SiteDeploy

type SiteDeploy struct {
	Id        int64
	RepoDid   syntax.DID
	Branch    string
	Dir       string
	CommitSHA string
	Status    SiteDeployStatus
	Trigger   SiteDeployTrigger
	Error     string
	CreatedAt time.Time
}

type SiteDeployStatus

type SiteDeployStatus string
const (
	SiteDeployStatusSuccess SiteDeployStatus = "success"
	SiteDeployStatusFailure SiteDeployStatus = "failure"
)

type SiteDeployTrigger

type SiteDeployTrigger string
const (
	SiteDeployTriggerConfigChange SiteDeployTrigger = "config_change"
	SiteDeployTriggerPush         SiteDeployTrigger = "push"
)

func (SiteDeployTrigger) Label

func (t SiteDeployTrigger) Label() string

type Spindle

type Spindle struct {
	Id           int
	Owner        syntax.DID
	Instance     string
	Verified     *time.Time
	Created      time.Time
	NeedsUpgrade bool
}

type SpindleMember

type SpindleMember struct {
	Id       int
	Did      syntax.DID // owner of the record
	Rkey     string     // rkey of the record
	Instance string
	Subject  syntax.DID // the member being added
	Created  time.Time
}

type Stack

type Stack []*Pull

func (Stack) Above

func (stack Stack) Above(pull *Pull) Stack

all pulls above this pull (including self) in this stack

func (Stack) Below

func (stack Stack) Below(pull *Pull) Stack

all pulls below this pull (including self) in this stack

nil if this pull does not belong to this stack

func (Stack) CombinedPatch

func (stack Stack) CombinedPatch() string

the combined format-patches of all the newest submissions in this stack

func (Stack) Mergeable

func (stack Stack) Mergeable() Stack

filter out PRs that are "active"

PRs that are still open are active

func (Stack) Position

func (stack Stack) Position(pull *Pull) int

position of this pull in the stack

func (Stack) StrictlyAbove

func (stack Stack) StrictlyAbove(pull *Pull) Stack

all pulls below this pull (excluding self) in this stack

func (Stack) StrictlyBelow

func (stack Stack) StrictlyBelow(pull *Pull) Stack

all pulls below this pull (excluding self) in this stack

type Star

type Star struct {
	Did         string
	SubjectType StarSubjectType
	Subject     string
	Created     time.Time
	Rkey        string
}

type StarSubjectType

type StarSubjectType string
const (
	StarSubjectRepo   StarSubjectType = "repo"
	StarSubjectString StarSubjectType = "string"
)

type StateRecord

type StateRecord struct {
	Did        string
	Rkey       string
	Subject    syntax.ATURI
	Value      StateValue
	SortMicros int64
}

func IssueStateFromRecord

func IssueStateFromRecord(did, rkey string, record tangled.RepoIssueState) (StateRecord, error)

func PullStatusFromRecord

func PullStatusFromRecord(did, rkey string, record tangled.RepoPullStatus) (StateRecord, error)

type StateValue

type StateValue string
const (
	StateOpen   StateValue = "open"
	StateClosed StateValue = "closed"
	StateMerged StateValue = "merged"
)

type Status

type Status uint32
const (
	Registered Status = iota
	Pending
	NeedsUpgrade
)

type String

type String struct {
	Did  syntax.DID
	Rkey string

	Filename    string
	Description string
	Contents    string
	Created     time.Time
	Edited      *time.Time
}

func StringFromRecord

func StringFromRecord(did, rkey string, record tangled.String) String

func (*String) AsRecord

func (s *String) AsRecord() tangled.String

func (*String) AtUri

func (s *String) AtUri() syntax.ATURI

func (String) Stats

func (s String) Stats() StringStats

func (*String) Validate

func (s *String) Validate() error

type StringStar

type StringStar struct {
	Star
	String *String
}

StringStar is used for reverse mapping to strings

type StringStats

type StringStats struct {
	LineCount uint64
	ByteCount uint64
}

type TimelineEvent

type TimelineEvent struct {
	*Repo
	*Follow
	*RepoStar

	EventAt time.Time

	// optional: populate only if Repo is a fork
	Source *Repo

	// optional: populate only if event is Follow
	*Profile
	*FollowStats
	*FollowStatus

	// optional: populate only if event is Repo
	IsStarred bool
	StarCount int64
}

type TimelineGroup

type TimelineGroup struct {
	Primary TimelineEvent
	Others  []TimelineEvent
}

TimelineGroup is a primary TimelineEvent plus zero or more peer events that share the same operation+target (same repo starred, same user followed) and arrived consecutively. Primary is the newest of the group; Others holds the older peers in descending order. For non-collapsible events (repo create) Others is always empty.

func (TimelineGroup) IsCollapsed

func (g TimelineGroup) IsCollapsed() bool

func (TimelineGroup) OthersCount

func (g TimelineGroup) OthersCount() int

type Trigger

type Trigger struct {
	Id   int
	Kind workflow.TriggerKind

	// push trigger fields
	PushRef    *string
	PushNewSha *string
	PushOldSha *string

	// pull request trigger fields
	PRSourceBranch *string
	PRTargetBranch *string
	PRSourceSha    *string
	PRAction       *string
}

func (*Trigger) IsPullRequest

func (t *Trigger) IsPullRequest() bool

func (*Trigger) IsPush

func (t *Trigger) IsPush() bool

func (*Trigger) TargetRef

func (t *Trigger) TargetRef() string

type Validator

type Validator interface {
	// Validate checks the object and returns any error.
	Validate() error
}

type ValueType

type ValueType struct {
	Type   ConcreteType    `json:"type"`
	Format ValueTypeFormat `json:"format,omitempty"`
	Enum   []string        `json:"enum,omitempty"`
}

ValueType represents an atproto lexicon type definition with constraints

func ValueTypeFromRecord

func ValueTypeFromRecord(record tangled.LabelDefinition_ValueType) ValueType

func (*ValueType) AsRecord

func (ValueType) IsAnyFormat

func (vt ValueType) IsAnyFormat() bool

func (ValueType) IsBool

func (vt ValueType) IsBool() bool

func (ValueType) IsConcreteType

func (vt ValueType) IsConcreteType() bool

func (ValueType) IsDidFormat

func (vt ValueType) IsDidFormat() bool

func (ValueType) IsEnum

func (vt ValueType) IsEnum() bool

func (ValueType) IsInt

func (vt ValueType) IsInt() bool

func (ValueType) IsNull

func (vt ValueType) IsNull() bool

func (ValueType) IsString

func (vt ValueType) IsString() bool

type ValueTypeFormat

type ValueTypeFormat string
const (
	ValueTypeFormatAny ValueTypeFormat = "any"
	ValueTypeFormatDid ValueTypeFormat = "did"
)

type VanityStat

type VanityStat struct {
	Kind  VanityStatKind
	Value uint64
}

type VanityStatKind

type VanityStatKind string
const (
	VanityStatMergedPRCount    VanityStatKind = "merged-pull-request-count"
	VanityStatClosedPRCount    VanityStatKind = "closed-pull-request-count"
	VanityStatOpenPRCount      VanityStatKind = "open-pull-request-count"
	VanityStatOpenIssueCount   VanityStatKind = "open-issue-count"
	VanityStatClosedIssueCount VanityStatKind = "closed-issue-count"
	VanityStatRepositoryCount  VanityStatKind = "repository-count"
	VanityStatStarCount        VanityStatKind = "star-count"
	VanityStatNone             VanityStatKind = ""
)

func ParseVanityStatKind

func ParseVanityStatKind(s string) VanityStatKind

func (VanityStatKind) String

func (v VanityStatKind) String() string

type Vouch

type Vouch struct {
	Did        syntax.DID
	SubjectDid syntax.DID
	Cid        cid.Cid
	Kind       VouchKind
	Reason     *string
	Evidences  []syntax.ATURI
	CreatedAt  time.Time
}

func (Vouch) IsDenounce

func (v Vouch) IsDenounce() bool

func (Vouch) IsVouch

func (v Vouch) IsVouch() bool

type VouchKind

type VouchKind string
const (
	VouchKindVouch    VouchKind = "vouch"
	VouchKindDenounce VouchKind = "denounce"
)

func ParseVouchKind

func ParseVouchKind(v string) (VouchKind, error)

type VouchRelationship

type VouchRelationship struct {
	ViewerDid  syntax.DID
	SubjectDid syntax.DID

	NetworkVouches []Vouch
}

func (*VouchRelationship) DenounceStrength

func (vr *VouchRelationship) DenounceStrength() int

func (*VouchRelationship) GetDirectVouch

func (vr *VouchRelationship) GetDirectVouch() *Vouch

func (*VouchRelationship) IndirectVouches

func (vr *VouchRelationship) IndirectVouches() []Vouch

func (*VouchRelationship) IsDirectDenounce

func (vr *VouchRelationship) IsDirectDenounce() bool

func (*VouchRelationship) IsDirectVouch

func (vr *VouchRelationship) IsDirectVouch() bool

func (*VouchRelationship) IsEmpty

func (vr *VouchRelationship) IsEmpty() bool

func (*VouchRelationship) IsIndirectDenounce

func (vr *VouchRelationship) IsIndirectDenounce() bool

func (*VouchRelationship) IsIndirectVouch

func (vr *VouchRelationship) IsIndirectVouch() bool

func (*VouchRelationship) IsMixed

func (vr *VouchRelationship) IsMixed() bool

func (*VouchRelationship) VouchStrength

func (vr *VouchRelationship) VouchStrength() int

type VouchStats

type VouchStats struct {
	Vouches   int64
	Denounces int64
}

type VouchSuggestion

type VouchSuggestion struct {
	Did               syntax.DID
	Reason            string
	VouchRelationship *VouchRelationship
}

type Webhook

type Webhook struct {
	Id        int64
	RepoDid   syntax.DID
	Url       string
	Secret    string
	Active    bool
	Events    []string // comma-separated event types
	CreatedAt time.Time
	UpdatedAt time.Time
}

func (*Webhook) HasEvent

func (w *Webhook) HasEvent(event WebhookEvent) bool

HasEvent checks if the webhook is subscribed to a specific event

type WebhookDelivery

type WebhookDelivery struct {
	Id           int64
	WebhookId    int64
	Event        string
	DeliveryId   string // UUID for tracking
	Url          string
	RequestBody  string
	ResponseCode int
	ResponseBody string
	Success      bool
	CreatedAt    time.Time
}

type WebhookEvent

type WebhookEvent string
const (
	WebhookEventPush        WebhookEvent = "push"
	WebhookEventRepoRenamed WebhookEvent = "repository:renamed"
)

type WebhookPayload

type WebhookPayload struct {
	Ref        string            `json:"ref"`
	Before     string            `json:"before"`
	After      string            `json:"after"`
	Repository WebhookRepository `json:"repository"`
	Pusher     WebhookUser       `json:"pusher"`
}

WebhookPayload represents the webhook payload structure

type WebhookRenamePayload

type WebhookRenamePayload struct {
	OldName    string            `json:"old_name"`
	NewName    string            `json:"new_name"`
	Repository WebhookRepository `json:"repository"`
	Sender     WebhookUser       `json:"sender"`
}

WebhookRenamePayload represents the payload for a repository:renamed event

type WebhookRepository

type WebhookRepository struct {
	Name        string      `json:"name"`
	FullName    string      `json:"full_name"`
	Description string      `json:"description"`
	Fork        bool        `json:"fork"`
	HtmlUrl     string      `json:"html_url"`
	CloneUrl    string      `json:"clone_url"`
	SshUrl      string      `json:"ssh_url"`
	Website     string      `json:"website,omitempty"`
	StarsCount  int         `json:"stars_count,omitempty"`
	OpenIssues  int         `json:"open_issues_count,omitempty"`
	CreatedAt   string      `json:"created_at"`
	UpdatedAt   string      `json:"updated_at"`
	Owner       WebhookUser `json:"owner"`
}

WebhookRepository represents repository information in webhook payload

type WebhookUser

type WebhookUser struct {
	Did string `json:"did"`
}

WebhookUser represents user information in webhook payload

type WorkflowStatus

type WorkflowStatus struct {
	Data []PipelineStatus
}

func (WorkflowStatus) Latest

func (w WorkflowStatus) Latest() PipelineStatus

func (WorkflowStatus) TimeTaken

func (w WorkflowStatus) TimeTaken() time.Duration

time taken by this workflow to reach an "end state"

Source Files

  • artifact.go
  • bsky.go
  • codesearch.go
  • collaborator.go
  • comment.go
  • email.go
  • entity_state.go
  • follow.go
  • issue.go
  • knot_member.go
  • label.go
  • language.go
  • migration.go
  • notifications.go
  • onboarding.go
  • pipeline.go
  • preferences.go
  • profile.go
  • pubkey.go
  • pull.go
  • punchcard.go
  • reaction.go
  • recents.go
  • reference.go
  • registration.go
  • repo.go
  • search.go
  • signup.go
  • site_deploy.go
  • sites.go
  • spindle.go
  • star.go
  • string.go
  • timeline.go
  • validator.go
  • vouch.go
  • webhook.go

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址