Documentation ¶
Overview ¶
Package gtsmodel contains types used *internally* by GoToSocial and added/removed/selected from the database. These types should never be serialized and/or sent out via public APIs, as they contain sensitive information. The annotation used on these structs is for handling them via the bun-db ORM. See here for more info on bun model annotations: https://bun.uptrace.dev/guide/models.html
Package gtsmodel contains types used *internally* by GoToSocial and added/removed/selected from the database. These types should never be serialized and/or sent out via public APIs, as they contain sensitive information. The annotation used on these structs is for handling them via the bun-db ORM. See here for more info on bun model annotations: https://bun.uptrace.dev/guide/models.html
Index ¶
- func ConversationOtherAccountsKey(otherAccountIDs []string) string
- type Account
- func (a *Account) AlsoKnownAsPopulated() bool
- func (a *Account) EmojisPopulated() bool
- func (a *Account) IsAliasedTo(uri string) bool
- func (a *Account) IsInstance() bool
- func (a *Account) IsLocal() bool
- func (a *Account) IsMoving() bool
- func (a *Account) IsNew() bool
- func (a *Account) IsRemote() bool
- func (a *Account) IsSuspended() bool
- func (a *Account) PubKeyExpired() bool
- type AccountNote
- type AccountSettings
- type AccountStats
- type AccountToEmoji
- type AdminAction
- type AdminActionCategory
- type AdminActionType
- type AdvancedMigration
- type Application
- type Block
- type Client
- type Content
- type Conversation
- type ConversationToStatus
- type DeniedUser
- type DomainAllow
- func (d *DomainAllow) GetCreatedAt() time.Time
- func (d *DomainAllow) GetCreatedByAccount() *Account
- func (d *DomainAllow) GetCreatedByAccountID() string
- func (d *DomainAllow) GetDomain() string
- func (d *DomainAllow) GetID() string
- func (d *DomainAllow) GetObfuscate() *bool
- func (d *DomainAllow) GetPrivateComment() string
- func (d *DomainAllow) GetPublicComment() string
- func (d *DomainAllow) GetSubscriptionID() string
- func (d *DomainAllow) GetType() DomainPermissionType
- func (d *DomainAllow) GetUpdatedAt() time.Time
- type DomainBlock
- func (d *DomainBlock) GetCreatedAt() time.Time
- func (d *DomainBlock) GetCreatedByAccount() *Account
- func (d *DomainBlock) GetCreatedByAccountID() string
- func (d *DomainBlock) GetDomain() string
- func (d *DomainBlock) GetID() string
- func (d *DomainBlock) GetObfuscate() *bool
- func (d *DomainBlock) GetPrivateComment() string
- func (d *DomainBlock) GetPublicComment() string
- func (d *DomainBlock) GetSubscriptionID() string
- func (d *DomainBlock) GetType() DomainPermissionType
- func (d *DomainBlock) GetUpdatedAt() time.Time
- type DomainPermission
- type DomainPermissionType
- type EmailDomainBlock
- type Emoji
- type EmojiCategory
- type Field
- type File
- type FileMeta
- type FileType
- type Filter
- type FilterAction
- type FilterKeyword
- type FilterStatus
- type Focus
- type Follow
- type FollowRequest
- type FollowedTag
- type HeaderFilter
- type HeaderFilterAllow
- type HeaderFilterBlock
- type Instance
- type InteractionPolicy
- func DefaultInteractionPolicyDirect() *InteractionPolicy
- func DefaultInteractionPolicyFollowersOnly() *InteractionPolicy
- func DefaultInteractionPolicyFor(v Visibility) *InteractionPolicy
- func DefaultInteractionPolicyPublic() *InteractionPolicy
- func DefaultInteractionPolicyUnlocked() *InteractionPolicy
- type InteractionRequest
- type InteractionType
- type List
- type ListEntry
- type Marker
- type MarkerName
- type MediaAttachment
- type Mention
- type Move
- type NewSignup
- type Notification
- type NotificationType
- type Original
- type ParseMentionFunc
- type PolicyCheckResult
- type PolicyPermission
- type PolicyRules
- type PolicyValue
- type PolicyValues
- type Poll
- type PollVote
- type ProcessingStatus
- type Relationship
- type RepliesPolicy
- type Report
- type RouterSession
- type Rule
- type SinBinStatus
- type Small
- type Status
- func (s *Status) AttachmentsPopulated() bool
- func (s *Status) BelongsToAccount(accountID string) bool
- func (s *Status) EmojisPopulated() bool
- func (s *Status) EmojisUpToDate(other *Status) bool
- func (s *Status) GetAccountID() string
- func (s *Status) GetAttachmentByRemoteURL(url string) (*MediaAttachment, bool)
- func (s *Status) GetBoostOfAccountID() string
- func (s *Status) GetBoostOfID() string
- func (s *Status) GetID() string
- func (s *Status) GetMentionByTargetURI(uri string) (*Mention, bool)
- func (s *Status) GetMentionByUsernameDomain(username, domain string) (*Mention, bool)
- func (s *Status) GetTagByName(name string) (*Tag, bool)
- func (s *Status) IsLocal() bool
- func (s *Status) IsLocalOnly() bool
- func (s *Status) MentionsAccount(accountID string) bool
- func (s *Status) MentionsPopulated() bool
- func (s *Status) TagsPopulated() bool
- type StatusBookmark
- type StatusFave
- type StatusMute
- type StatusToEmoji
- type StatusToTag
- type Tag
- type Theme
- type Thread
- type ThreadMute
- type ThreadToStatus
- type Thumbnail
- type Token
- type Tombstone
- type User
- type UserMute
- type Visibility
- type WorkerTask
- type WorkerType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConversationOtherAccountsKey ¶ added in v0.17.0
ConversationOtherAccountsKey creates an OtherAccountsKey from a list of OtherAccountIDs.
Types ¶
type Account ¶
type Account struct { ID string `bun:"type:CHAR(26),pk,nullzero,notnull,unique"` // id of this item in the database CreatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item created. UpdatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item was last updated. FetchedAt time.Time `bun:"type:timestamptz,nullzero"` // when was item (remote) last fetched. Username string `bun:",nullzero,notnull,unique:usernamedomain"` // Username of the account, should just be a string of [a-zA-Z0-9_]. Can be added to domain to create the full username in the form “[username]@[domain]“ eg., “user_96@example.org“. Username and domain should be unique *with* each other Domain string `bun:",nullzero,unique:usernamedomain"` // Domain of the account, will be null if this is a local account, otherwise something like “example.org“. Should be unique with username. AvatarMediaAttachmentID string `bun:"type:CHAR(26),nullzero"` // Database ID of the media attachment, if present AvatarMediaAttachment *MediaAttachment `bun:"rel:belongs-to"` // MediaAttachment corresponding to avatarMediaAttachmentID AvatarRemoteURL string `bun:",nullzero"` // For a non-local account, where can the header be fetched? HeaderMediaAttachmentID string `bun:"type:CHAR(26),nullzero"` // Database ID of the media attachment, if present HeaderMediaAttachment *MediaAttachment `bun:"rel:belongs-to"` // MediaAttachment corresponding to headerMediaAttachmentID HeaderRemoteURL string `bun:",nullzero"` // For a non-local account, where can the header be fetched? DisplayName string `bun:""` // DisplayName for this account. Can be empty, then just the Username will be used for display purposes. EmojiIDs []string `bun:"emojis,array"` // Database IDs of any emojis used in this account's bio, display name, etc Emojis []*Emoji `bun:"attached_emojis,m2m:account_to_emojis"` // Emojis corresponding to emojiIDs. https://bun.uptrace.dev/guide/relations.html#many-to-many-relation Fields []*Field `bun:""` // A slice of of fields that this account has added to their profile. FieldsRaw []*Field `bun:""` // The raw (unparsed) content of fields that this account has added to their profile, without conversion to HTML, only available when requester = target Note string `bun:""` // A note that this account has on their profile (ie., the account's bio/description of themselves) NoteRaw string `bun:""` // The raw contents of .Note without conversion to HTML, only available when requester = target Memorial *bool `bun:",default:false"` // Is this a memorial account, ie., has the user passed away? AlsoKnownAsURIs []string `bun:"also_known_as_uris,array"` // This account is associated with these account URIs. AlsoKnownAs []*Account `bun:"-"` // This account is associated with these accounts (field not stored in the db). MovedToURI string `bun:",nullzero"` // This account has (or claims to have) moved to this account URI. Even if this field is set the move may not yet have been processed. Check `move` for this. MovedTo *Account `bun:"-"` // This account has moved to this account (field not stored in the db). MoveID string `bun:"type:CHAR(26),nullzero"` // ID of a Move in the database for this account. Only set if we received or created a Move activity for which this account URI was the origin. Move *Move `bun:"-"` // Move corresponding to MoveID, if set. Bot *bool `bun:",default:false"` // Does this account identify itself as a bot? Locked *bool `bun:",default:true"` // Does this account need an approval for new followers? Discoverable *bool `bun:",default:false"` // Should this account be shown in the instance's profile directory? URI string `bun:",nullzero,notnull,unique"` // ActivityPub URI for this account. URL string `bun:",nullzero,unique"` // Web URL for this account's profile InboxURI string `bun:",nullzero,unique"` // Address of this account's ActivityPub inbox, for sending activity to OutboxURI string `bun:",nullzero,unique"` // Address of this account's activitypub outbox FollowingURI string `bun:",nullzero,unique"` // URI for getting the following list of this account FollowersURI string `bun:",nullzero,unique"` // URI for getting the followers list of this account FeaturedCollectionURI string `bun:",nullzero,unique"` // URL for getting the featured collection list of this account ActorType string `bun:",nullzero,notnull"` // What type of activitypub actor is this account? PrivateKey *rsa.PrivateKey `bun:""` // Privatekey for signing activitypub requests, will only be defined for local accounts PublicKey *rsa.PublicKey `bun:",notnull"` // Publickey for authorizing signed activitypub requests, will be defined for both local and remote accounts PublicKeyURI string `bun:",nullzero,notnull,unique"` // Web-reachable location of this account's public key PublicKeyExpiresAt time.Time `bun:"type:timestamptz,nullzero"` // PublicKey will expire/has expired at given time, and should be fetched again as appropriate. Only ever set for remote accounts. SensitizedAt time.Time `bun:"type:timestamptz,nullzero"` // When was this account set to have all its media shown as sensitive? SilencedAt time.Time `bun:"type:timestamptz,nullzero"` // When was this account silenced (eg., statuses only visible to followers, not public)? SuspendedAt time.Time `bun:"type:timestamptz,nullzero"` // When was this account suspended (eg., don't allow it to log in/post, don't accept media/posts from this account) SuspensionOrigin string `bun:"type:CHAR(26),nullzero"` // id of the database entry that caused this account to become suspended -- can be an account ID or a domain block ID Settings *AccountSettings `bun:"-"` // gtsmodel.AccountSettings for this account. Stats *AccountStats `bun:"-"` // gtsmodel.AccountStats for this account. }
Account represents either a local or a remote fediverse account, gotosocial or otherwise (mastodon, pleroma, etc).
func (*Account) AlsoKnownAsPopulated ¶ added in v0.14.0
AlsoKnownAsPopulated returns whether alsoKnownAs accounts are populated according to current AlsoKnownAsURIs.
func (*Account) EmojisPopulated ¶ added in v0.8.0
EmojisPopulated returns whether emojis are populated according to current EmojiIDs.
func (*Account) IsAliasedTo ¶ added in v0.15.0
IsAliasedTo returns true if account is aliased to the given account URI.
func (*Account) IsInstance ¶ added in v0.7.0
IsInstance returns whether account is an instance internal actor account.
func (*Account) IsMoving ¶ added in v0.15.0
IsMoving returns true if account is Moving or has Moved.
func (*Account) IsNew ¶ added in v0.13.3
IsNew returns whether an account is "new" in the sense that it has not been previously stored in the database.
func (*Account) IsRemote ¶ added in v0.7.0
IsRemote returns whether account is a remote user account.
func (*Account) IsSuspended ¶ added in v0.15.0
IsSuspended returns true if account has been suspended from this instance.
func (*Account) PubKeyExpired ¶ added in v0.12.0
PubKeyExpired returns true if the account's public key has been marked as expired, and the expiry time has passed.
type AccountNote ¶ added in v0.11.0
type AccountNote struct { ID string `bun:"type:CHAR(26),pk,nullzero,notnull,unique"` // id of this item in the database CreatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item created UpdatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item last updated AccountID string `bun:"type:CHAR(26),unique:account_notes_account_id_target_account_id_uniq,notnull,nullzero"` // ID of the local account that created the note Account *Account `bun:"rel:belongs-to"` // Account corresponding to accountID TargetAccountID string `bun:"type:CHAR(26),unique:account_notes_account_id_target_account_id_uniq,notnull,nullzero"` // Who is the target of this note? TargetAccount *Account `bun:"rel:belongs-to"` // Account corresponding to targetAccountID Comment string `bun:""` // The text of the note. }
AccountNote stores a private note from a local account related to any account.
type AccountSettings ¶ added in v0.15.0
type AccountSettings struct { AccountID string `bun:"type:CHAR(26),pk,nullzero,notnull,unique"` // AccountID that owns this settings. CreatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item created. UpdatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item was last updated. Privacy Visibility `bun:",nullzero"` // Default post privacy for this account Sensitive *bool `bun:",nullzero,notnull,default:false"` // Set posts from this account to sensitive by default? Language string `bun:",nullzero,notnull,default:'en'"` // What language does this account post in? StatusContentType string `bun:",nullzero"` // What is the default format for statuses posted by this account (only for local accounts). Theme string `bun:",nullzero"` // Preset CSS theme filename selected by this Account (empty string if nothing set). CustomCSS string `bun:",nullzero"` // Custom CSS that should be displayed for this Account's profile and statuses. EnableRSS *bool `bun:",nullzero,notnull,default:false"` // enable RSS feed subscription for this account's public posts at [URL]/feed HideCollections *bool `bun:",nullzero,notnull,default:false"` // Hide this account's followers/following collections. WebVisibility Visibility `bun:",nullzero,notnull,default:public"` // Visibility level of statuses that visitors can view via the web profile. InteractionPolicyDirect *InteractionPolicy `bun:""` // Interaction policy to use for new direct visibility statuses by this account. If null, assume default policy. InteractionPolicyMutualsOnly *InteractionPolicy `bun:""` // Interaction policy to use for new mutuals only visibility statuses. If null, assume default policy. InteractionPolicyFollowersOnly *InteractionPolicy `bun:""` // Interaction policy to use for new followers only visibility statuses. If null, assume default policy. InteractionPolicyUnlocked *InteractionPolicy `bun:""` // Interaction policy to use for new unlocked visibility statuses. If null, assume default policy. InteractionPolicyPublic *InteractionPolicy `bun:""` // Interaction policy to use for new public visibility statuses. If null, assume default policy. }
AccountSettings models settings / preferences for a local, non-instance account.
type AccountStats ¶ added in v0.16.0
type AccountStats struct { AccountID string `bun:"type:CHAR(26),pk,nullzero,notnull,unique"` // AccountID of this AccountStats. RegeneratedAt time.Time `bun:"type:timestamptz,nullzero"` // Time this stats model was last regenerated (ie., created from scratch using COUNTs). FollowersCount *int `bun:",nullzero,notnull"` // Number of accounts following AccountID. FollowingCount *int `bun:",nullzero,notnull"` // Number of accounts followed by AccountID. FollowRequestsCount *int `bun:",nullzero,notnull"` // Number of pending follow requests aimed at AccountID. StatusesCount *int `bun:",nullzero,notnull"` // Number of statuses created by AccountID. StatusesPinnedCount *int `bun:",nullzero,notnull"` // Number of statuses pinned by AccountID. LastStatusAt time.Time `bun:"type:timestamptz,nullzero"` // Time of most recent status created by AccountID. }
AccountStats models statistics for a remote or local account.
type AccountToEmoji ¶ added in v0.5.0
type AccountToEmoji struct { AccountID string `bun:"type:CHAR(26),unique:accountemoji,nullzero,notnull"` Account *Account `bun:"rel:belongs-to"` EmojiID string `bun:"type:CHAR(26),unique:accountemoji,nullzero,notnull"` Emoji *Emoji `bun:"rel:belongs-to"` }
AccountToEmoji is an intermediate struct to facilitate the many2many relationship between an account and one or more emojis.
type AdminAction ¶ added in v0.12.0
type AdminAction struct { ID string `bun:"type:CHAR(26),pk,nullzero,notnull,unique"` // ID of this item in the database. CreatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // Creation time of this item. UpdatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // Last updated time of this item. CompletedAt time.Time `bun:"type:timestamptz,nullzero"` // Completion time of this item. TargetCategory AdminActionCategory `bun:",nullzero,notnull"` // Category of the entity targeted by this action. TargetID string `bun:",nullzero,notnull"` // Identifier of the target. May be a ULID (in case of accounts), or a domain name (in case of domains). Target interface{} `bun:"-"` // Target of the action. Might be a domain string, might be an account. Type AdminActionType `bun:",nullzero,notnull"` // Type of action that was taken. AccountID string `bun:"type:CHAR(26),notnull,nullzero"` // Who performed this admin action. Account *Account `bun:"rel:has-one"` // Account corresponding to accountID Text string `bun:",nullzero"` // Free text field for explaining why this action was taken, or adding a note about this action. SendEmail *bool `bun:",nullzero,notnull,default:false"` // Send an email to the target account's user to explain what happened (local accounts only). ReportIDs []string `bun:"reports,array"` // IDs of any reports cited when creating this action. Reports []*Report `bun:"-"` // Reports corresponding to ReportIDs. Errors []string `bun:",array"` // String value of any error(s) encountered while processing. May be helpful for admins to debug. }
AdminAction models an action taken by an instance administrator towards an account, domain, etc.
func (*AdminAction) Key ¶ added in v0.12.0
func (a *AdminAction) Key() string
Key returns a key for the AdminAction which is unique only on its TargetCategory and TargetID fields. This key can be used to check if this AdminAction overlaps with another action performed on the same target, regardless of the Type of either this or the other action.
type AdminActionCategory ¶ added in v0.12.0
type AdminActionCategory uint8
AdminActionCategory describes the category of entity that this admin action targets.
const ( AdminActionCategoryUnknown AdminActionCategory = iota AdminActionCategoryAccount AdminActionCategoryDomain )
func NewAdminActionCategory ¶ added in v0.12.0
func NewAdminActionCategory(in string) AdminActionCategory
func (AdminActionCategory) String ¶ added in v0.12.0
func (c AdminActionCategory) String() string
type AdminActionType ¶ added in v0.2.2
type AdminActionType uint8
AdminActionType describes a type of action taken on an entity by an admin.
const ( AdminActionUnknown AdminActionType = iota AdminActionDisable AdminActionReenable AdminActionSilence AdminActionUnsilence AdminActionSuspend AdminActionUnsuspend AdminActionExpireKeys )
func NewAdminActionType ¶ added in v0.12.0
func NewAdminActionType(in string) AdminActionType
func (AdminActionType) String ¶ added in v0.12.0
func (t AdminActionType) String() string
type AdvancedMigration ¶ added in v0.17.0
type AdvancedMigration struct { ID string `bun:",pk,nullzero,notnull,unique"` // id of this migration (preassigned, not a ULID) CreatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item created UpdatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item last updated StateJSON []byte `bun:",nullzero"` // JSON dump of the migration state Finished *bool `bun:",nullzero,notnull,default:false"` // has this migration finished? }
AdvancedMigration stores state for an "advanced migration", which is a migration that doesn't fit into the Bun migration framework.
type Application ¶
type Application struct { ID string `bun:"type:CHAR(26),pk,nullzero,notnull,unique"` // id of this item in the database CreatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item created UpdatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item last updated Name string `bun:",notnull"` // name of the application given when it was created (eg., 'tusky') Website string `bun:",nullzero"` // website for the application given when it was created (eg., 'https://tusky.app') RedirectURI string `bun:",nullzero,notnull"` // redirect uri requested by the application for oauth2 flow ClientID string `bun:"type:CHAR(26),nullzero,notnull"` // id of the associated oauth client entity in the db ClientSecret string `bun:",nullzero,notnull"` // secret of the associated oauth client entity in the db Scopes string `bun:",notnull"` // scopes requested when this app was created }
Application represents an application that can perform actions on behalf of a user. It is used to authorize tokens etc, and is associated with an oauth client id in the database.
type Block ¶
type Block struct { ID string `bun:"type:CHAR(26),pk,nullzero,notnull,unique"` // id of this item in the database CreatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item created UpdatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item last updated URI string `bun:",notnull,nullzero,unique"` // ActivityPub uri of this block. AccountID string `bun:"type:CHAR(26),unique:blocksrctarget,notnull,nullzero"` // Who does this block originate from? Account *Account `bun:"rel:belongs-to"` // Account corresponding to accountID TargetAccountID string `bun:"type:CHAR(26),unique:blocksrctarget,notnull,nullzero"` // Who is the target of this block ? TargetAccount *Account `bun:"rel:belongs-to"` // Account corresponding to targetAccountID }
Block refers to the blocking of one account by another.
type Client ¶
type Client struct { ID string `bun:"type:CHAR(26),pk,nullzero,notnull,unique"` // id of this item in the database CreatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item created UpdatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item last updated Secret string `bun:",nullzero,notnull"` // secret generated when client was created Domain string `bun:",nullzero,notnull"` // domain requested for client UserID string `bun:"type:CHAR(26),nullzero"` // id of the user that this client acts on behalf of }
Client is a wrapper for OAuth client details.
type Content ¶ added in v0.13.0
Content models the simple string content of a status along with its ContentMap, which contains content entries keyed by BCP47 language tag.
Content and/or ContentMap may be zero/nil.
type Conversation ¶ added in v0.17.0
type Conversation struct { // ID of this item in the database. ID string `bun:"type:CHAR(26),pk,nullzero,notnull,unique"` // When was this item created? CreatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // When was this item last updated? UpdatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // Account that owns the conversation. AccountID string `` /* 154-byte string literal not displayed */ Account *Account `bun:"-"` // Other accounts participating in the conversation. // Doesn't include the owner. May be empty in the case of a DM to yourself. OtherAccountIDs []string `bun:"other_account_ids,array"` OtherAccounts []*Account `bun:"-"` // Denormalized lookup key derived from unique OtherAccountIDs, sorted and concatenated with commas. // May be empty in the case of a DM to yourself. OtherAccountsKey string `bun:",notnull,unique:conversations_thread_id_account_id_other_accounts_key_uniq"` // Thread that the conversation is part of. ThreadID string `bun:"type:CHAR(26),nullzero,notnull,unique:conversations_thread_id_account_id_other_accounts_key_uniq"` // ID of the last status in this conversation. LastStatusID string `bun:"type:CHAR(26),nullzero,notnull,unique:conversations_account_id_last_status_id_uniq"` LastStatus *Status `bun:"-"` // Has the owner read all statuses in this conversation? Read *bool `bun:",default:false"` }
Conversation represents direct messages between the owner account and a set of other accounts.
type ConversationToStatus ¶ added in v0.17.0
type ConversationToStatus struct { ConversationID string `bun:"type:CHAR(26),unique:conversation_to_statuses_conversation_id_status_id_uniq,nullzero,notnull"` Conversation *Conversation `bun:"rel:belongs-to"` StatusID string `bun:"type:CHAR(26),unique:conversation_to_statuses_conversation_id_status_id_uniq,nullzero,notnull"` Status *Status `bun:"rel:belongs-to"` }
ConversationToStatus is an intermediate struct to facilitate the many2many relationship between a conversation and its statuses, including but not limited to the last status. These are used only when deleting a status from a conversation.
type DeniedUser ¶ added in v0.16.0
type DeniedUser struct { ID string `bun:"type:CHAR(26),pk,nullzero,notnull,unique"` // id of this item in the database CreatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item created UpdatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item last updated Email string `bun:",nullzero,notnull"` // Email address provided on the sign-up form. Username string `bun:",nullzero,notnull"` // Username provided on the sign-up form. SignUpIP net.IP `bun:",nullzero"` // IP address the sign-up originated from. InviteID string `bun:"type:CHAR(26),nullzero"` // Invite ID provided on the sign-up form (if applicable). Locale string `bun:",nullzero"` // Locale provided on the sign-up form. CreatedByApplicationID string `bun:"type:CHAR(26),nullzero"` // ID of application used to create this sign-up. SignUpReason string `bun:",nullzero"` // Reason provided by user on the sign-up form. PrivateComment string `bun:",nullzero"` // Comment from instance admin about why this sign-up was denied. SendEmail *bool `bun:",nullzero,notnull,default:false"` // Send an email informing user that their sign-up has been denied. Message string `bun:",nullzero"` // Message to include when sending an email to the denied user's email address, if SendEmail is true. }
DeniedUser represents one user sign-up that was submitted to the instance and denied.
type DomainAllow ¶ added in v0.12.0
type DomainAllow struct { ID string `bun:"type:CHAR(26),pk,nullzero,notnull,unique"` // id of this item in the database CreatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item created UpdatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item last updated Domain string `bun:",nullzero,notnull"` // domain to allow. Eg. 'whatever.com' CreatedByAccountID string `bun:"type:CHAR(26),nullzero,notnull"` // Account ID of the creator of this allow CreatedByAccount *Account `bun:"rel:belongs-to"` // Account corresponding to createdByAccountID PrivateComment string `bun:""` // Private comment on this allow, viewable to admins PublicComment string `bun:""` // Public comment on this allow, viewable (optionally) by everyone Obfuscate *bool `bun:",nullzero,notnull,default:false"` // whether the domain name should appear obfuscated when displaying it publicly SubscriptionID string `bun:"type:CHAR(26),nullzero"` // if this allow was created through a subscription, what's the subscription ID? }
DomainAllow represents a federation allow towards a particular domain.
func (*DomainAllow) GetCreatedAt ¶ added in v0.12.0
func (d *DomainAllow) GetCreatedAt() time.Time
func (*DomainAllow) GetCreatedByAccount ¶ added in v0.12.0
func (d *DomainAllow) GetCreatedByAccount() *Account
func (*DomainAllow) GetCreatedByAccountID ¶ added in v0.12.0
func (d *DomainAllow) GetCreatedByAccountID() string
func (*DomainAllow) GetDomain ¶ added in v0.12.0
func (d *DomainAllow) GetDomain() string
func (*DomainAllow) GetID ¶ added in v0.12.0
func (d *DomainAllow) GetID() string
func (*DomainAllow) GetObfuscate ¶ added in v0.12.0
func (d *DomainAllow) GetObfuscate() *bool
func (*DomainAllow) GetPrivateComment ¶ added in v0.12.0
func (d *DomainAllow) GetPrivateComment() string
func (*DomainAllow) GetPublicComment ¶ added in v0.12.0
func (d *DomainAllow) GetPublicComment() string
func (*DomainAllow) GetSubscriptionID ¶ added in v0.12.0
func (d *DomainAllow) GetSubscriptionID() string
func (*DomainAllow) GetType ¶ added in v0.12.0
func (d *DomainAllow) GetType() DomainPermissionType
func (*DomainAllow) GetUpdatedAt ¶ added in v0.12.0
func (d *DomainAllow) GetUpdatedAt() time.Time
type DomainBlock ¶
type DomainBlock struct { ID string `bun:"type:CHAR(26),pk,nullzero,notnull,unique"` // id of this item in the database CreatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item created UpdatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item last updated Domain string `bun:",nullzero,notnull"` // domain to block. Eg. 'whatever.com' CreatedByAccountID string `bun:"type:CHAR(26),nullzero,notnull"` // Account ID of the creator of this block CreatedByAccount *Account `bun:"rel:belongs-to"` // Account corresponding to createdByAccountID PrivateComment string `bun:""` // Private comment on this block, viewable to admins PublicComment string `bun:""` // Public comment on this block, viewable (optionally) by everyone Obfuscate *bool `bun:",nullzero,notnull,default:false"` // whether the domain name should appear obfuscated when displaying it publicly SubscriptionID string `bun:"type:CHAR(26),nullzero"` // if this block was created through a subscription, what's the subscription ID? }
DomainBlock represents a federation block against a particular domain
func (*DomainBlock) GetCreatedAt ¶ added in v0.12.0
func (d *DomainBlock) GetCreatedAt() time.Time
func (*DomainBlock) GetCreatedByAccount ¶ added in v0.12.0
func (d *DomainBlock) GetCreatedByAccount() *Account
func (*DomainBlock) GetCreatedByAccountID ¶ added in v0.12.0
func (d *DomainBlock) GetCreatedByAccountID() string
func (*DomainBlock) GetDomain ¶ added in v0.12.0
func (d *DomainBlock) GetDomain() string
func (*DomainBlock) GetID ¶ added in v0.12.0
func (d *DomainBlock) GetID() string
func (*DomainBlock) GetObfuscate ¶ added in v0.12.0
func (d *DomainBlock) GetObfuscate() *bool
func (*DomainBlock) GetPrivateComment ¶ added in v0.12.0
func (d *DomainBlock) GetPrivateComment() string
func (*DomainBlock) GetPublicComment ¶ added in v0.12.0
func (d *DomainBlock) GetPublicComment() string
func (*DomainBlock) GetSubscriptionID ¶ added in v0.12.0
func (d *DomainBlock) GetSubscriptionID() string
func (*DomainBlock) GetType ¶ added in v0.12.0
func (d *DomainBlock) GetType() DomainPermissionType
func (*DomainBlock) GetUpdatedAt ¶ added in v0.12.0
func (d *DomainBlock) GetUpdatedAt() time.Time
type DomainPermission ¶ added in v0.12.0
type DomainPermission interface { GetID() string GetCreatedAt() time.Time GetUpdatedAt() time.Time GetDomain() string GetCreatedByAccountID() string GetCreatedByAccount() *Account GetPrivateComment() string GetPublicComment() string GetObfuscate() *bool GetSubscriptionID() string GetType() DomainPermissionType }
DomainPermission models a domain permission entry (block/allow).
type DomainPermissionType ¶ added in v0.12.0
type DomainPermissionType uint8
Domain permission type.
const ( DomainPermissionUnknown DomainPermissionType = iota DomainPermissionBlock // Explicitly block a domain. DomainPermissionAllow // Explicitly allow a domain. )
func NewDomainPermissionType ¶ added in v0.12.0
func NewDomainPermissionType(in string) DomainPermissionType
func (DomainPermissionType) String ¶ added in v0.12.0
func (p DomainPermissionType) String() string
type EmailDomainBlock ¶
type EmailDomainBlock struct { ID string `bun:"type:CHAR(26),pk,nullzero,notnull,unique"` // id of this item in the database CreatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item created UpdatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item last updated Domain string `bun:",nullzero,notnull"` // Email domain to block. Eg. 'gmail.com' or 'hotmail.com' CreatedByAccountID string `bun:"type:CHAR(26),nullzero,notnull"` // Account ID of the creator of this block CreatedByAccount *Account `bun:"rel:belongs-to"` // Account corresponding to createdByAccountID }
EmailDomainBlock represents a domain that the server should automatically reject sign-up requests from.
type Emoji ¶
type Emoji struct { ID string `bun:"type:CHAR(26),pk,nullzero,notnull,unique"` // id of this item in the database CreatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item created UpdatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item last updated Shortcode string `bun:",nullzero,notnull,unique:domainshortcode"` // String shortcode for this emoji -- the part that's between colons. This should be a-zA-Z_ eg., 'blob_hug' 'purple_heart' 'Gay_Otter' Must be unique with domain. Domain string `bun:",nullzero,unique:domainshortcode"` // Origin domain of this emoji, eg 'example.org', 'queer.party'. empty string for local emojis. ImageRemoteURL string `bun:",nullzero"` // Where can this emoji be retrieved remotely? Null for local emojis. ImageStaticRemoteURL string `bun:",nullzero"` // Where can a static / non-animated version of this emoji be retrieved remotely? Null for local emojis. ImageURL string `bun:",nullzero"` // Where can this emoji be retrieved from the local server? Null for remote emojis. ImageStaticURL string `bun:",nullzero"` // Where can a static version of this emoji be retrieved from the local server? Null for remote emojis. ImagePath string `bun:",notnull"` // Path of the emoji image in the server storage system. ImageStaticPath string `bun:",notnull"` // Path of a static version of the emoji image in the server storage system ImageContentType string `bun:",notnull"` // MIME content type of the emoji image ImageStaticContentType string `bun:",notnull"` // MIME content type of the static version of the emoji image. ImageFileSize int `bun:",notnull"` // Size of the emoji image file in bytes, for serving purposes. ImageStaticFileSize int `bun:",notnull"` // Size of the static version of the emoji image file in bytes, for serving purposes. Disabled *bool `bun:",nullzero,notnull,default:false"` // Has a moderation action disabled this emoji from being shown? URI string `bun:",nullzero,notnull,unique"` // ActivityPub uri of this emoji. Something like 'https://example.org/emojis/1234' VisibleInPicker *bool `bun:",nullzero,notnull,default:true"` // Is this emoji visible in the admin emoji picker? Category *EmojiCategory `bun:"rel:belongs-to"` // In which emoji category is this emoji visible? CategoryID string `bun:"type:CHAR(26),nullzero"` // ID of the category this emoji belongs to. Cached *bool `bun:",nullzero,notnull,default:false"` // whether emoji is cached in locally in gotosocial storage. }
Emoji represents a custom emoji that's been uploaded through the admin UI or downloaded from a remote instance.
func (*Emoji) IsLocal ¶ added in v0.14.0
IsLocal returns true if the emoji is local to this instance., ie., it did not originate from a remote instance.
func (*Emoji) ShortcodeDomain ¶ added in v0.17.0
ShortcodeDomain returns the [shortcode]@[domain] for the given emoji.
type EmojiCategory ¶ added in v0.6.0
type EmojiCategory struct { ID string `bun:"type:CHAR(26),pk,nullzero,notnull,unique"` // id of this item in the database CreatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item created UpdatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item last updated Name string `bun:",nullzero,notnull,unique"` // name of this category }
EmojiCategory represents a grouping of custom emojis.
type Field ¶
type Field struct { Name string // Name of this field. Value string // Value of this field. VerifiedAt time.Time `bun:",nullzero"` // This field was verified at (optional). }
Field represents a key value field on an account, for things like pronouns, website, etc. VerifiedAt is optional, to be used only if Value is a URL to a webpage that contains the username of the user.
type File ¶
type File struct { Path string `bun:",notnull"` // Path of the file in storage. ContentType string `bun:",notnull"` // MIME content type of the file. FileSize int `bun:",notnull"` // File size in bytes }
File refers to the metadata for the whole file
type FileMeta ¶
type FileMeta struct { Original Original `bun:"embed:original_"` Small Small `bun:"embed:small_"` Focus Focus `bun:"embed:focus_"` }
FileMeta describes metadata about the actual contents of the file.
type FileType ¶
type FileType int
FileType refers to the file type of the media attaachment.
const ( // MediaAttachment file types. FileTypeUnknown FileType = 0 // FileTypeUnknown is for unknown file types (surprise surprise!) FileTypeImage FileType = 1 // FileTypeImage is for jpegs, pngs, and standard gifs FileTypeAudio FileType = 2 // FileTypeAudio is for audio-only files (no video) FileTypeVideo FileType = 3 // FileTypeVideo is for files with audio + visual FileTypeGifv FileType = 4 // FileTypeGifv is for short video-only files (20s or less, mp4, no audio). )
type Filter ¶ added in v0.15.0
type Filter struct { ID string `bun:"type:CHAR(26),pk,nullzero,notnull,unique"` // id of this item in the database CreatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item created UpdatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item last updated ExpiresAt time.Time `bun:"type:timestamptz,nullzero"` // Time filter should expire. If null, should not expire. AccountID string `bun:"type:CHAR(26),notnull,nullzero,unique:filters_account_id_title_uniq"` // ID of the local account that created the filter. Title string `bun:",nullzero,notnull,unique:filters_account_id_title_uniq"` // The name of the filter. Action FilterAction `bun:",nullzero,notnull"` // The action to take. Keywords []*FilterKeyword `bun:"-"` // Keywords for this filter. Statuses []*FilterStatus `bun:"-"` // Statuses for this filter. ContextHome *bool `bun:",nullzero,notnull,default:false"` // Apply filter to home timeline and lists. ContextNotifications *bool `bun:",nullzero,notnull,default:false"` // Apply filter to notifications. ContextPublic *bool `bun:",nullzero,notnull,default:false"` // Apply filter to home timeline and lists. ContextThread *bool `bun:",nullzero,notnull,default:false"` // Apply filter when viewing a status's associated thread. ContextAccount *bool `bun:",nullzero,notnull,default:false"` // Apply filter when viewing an account profile. }
Filter stores a filter created by a local account.
type FilterAction ¶ added in v0.15.0
type FilterAction string
FilterAction represents the action to take on a filtered status.
const ( // FilterActionNone filters should not exist, except internally, for partially constructed or invalid filters. FilterActionNone FilterAction = "" // FilterActionWarn means that the status should be shown behind a warning. FilterActionWarn FilterAction = "warn" // FilterActionHide means that the status should be removed from timeline results entirely. FilterActionHide FilterAction = "hide" )
type FilterKeyword ¶ added in v0.15.0
type FilterKeyword struct { ID string `bun:"type:CHAR(26),pk,nullzero,notnull,unique"` // id of this item in the database CreatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item created UpdatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item last updated AccountID string `bun:"type:CHAR(26),notnull,nullzero"` // ID of the local account that created the filter keyword. FilterID string `bun:"type:CHAR(26),notnull,nullzero,unique:filter_keywords_filter_id_keyword_uniq"` // ID of the filter that this keyword belongs to. Filter *Filter `bun:"-"` // Filter corresponding to FilterID Keyword string `bun:",nullzero,notnull,unique:filter_keywords_filter_id_keyword_uniq"` // The keyword or phrase to filter against. WholeWord *bool `bun:",nullzero,notnull,default:false"` // Should the filter consider word boundaries? Regexp *regexp.Regexp `bun:"-"` // pre-prepared regular expression }
FilterKeyword stores a single keyword to filter statuses against.
func (*FilterKeyword) Compile ¶ added in v0.16.0
func (k *FilterKeyword) Compile() (err error)
Compile will compile this FilterKeyword as a prepared regular expression.
type FilterStatus ¶ added in v0.15.0
type FilterStatus struct { ID string `bun:"type:CHAR(26),pk,nullzero,notnull,unique"` // id of this item in the database CreatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item created UpdatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item last updated AccountID string `bun:"type:CHAR(26),notnull,nullzero"` // ID of the local account that created the filter keyword. FilterID string `bun:"type:CHAR(26),notnull,nullzero,unique:filter_statuses_filter_id_status_id_uniq"` // ID of the filter that this keyword belongs to. Filter *Filter `bun:"-"` // Filter corresponding to FilterID StatusID string `bun:"type:CHAR(26),notnull,nullzero,unique:filter_statuses_filter_id_status_id_uniq"` // ID of the status to filter. }
FilterStatus stores a single status to filter.
type Focus ¶
Focus describes the 'center' of the image for display purposes. X and Y should each be between -1 and 1
type Follow ¶
type Follow struct { ID string `bun:"type:CHAR(26),pk,nullzero,notnull,unique"` // id of this item in the database CreatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item created UpdatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item last updated URI string `bun:",notnull,nullzero,unique"` // ActivityPub uri of this follow. AccountID string `bun:"type:CHAR(26),unique:srctarget,notnull,nullzero"` // Who does this follow originate from? Account *Account `bun:"rel:belongs-to"` // Account corresponding to accountID TargetAccountID string `bun:"type:CHAR(26),unique:srctarget,notnull,nullzero"` // Who is the target of this follow ? TargetAccount *Account `bun:"rel:belongs-to"` // Account corresponding to targetAccountID ShowReblogs *bool `bun:",nullzero,notnull,default:true"` // Does this follow also want to see reblogs and not just posts? Notify *bool `bun:",nullzero,notnull,default:false"` // does the following account want to be notified when the followed account posts? }
Follow represents one account following another, and the metadata around that follow.
type FollowRequest ¶
type FollowRequest struct { ID string `bun:"type:CHAR(26),pk,nullzero,notnull,unique"` // id of this item in the database CreatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item created UpdatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item last updated URI string `bun:",notnull,nullzero,unique"` // ActivityPub uri of this follow (request). AccountID string `bun:"type:CHAR(26),unique:frsrctarget,notnull,nullzero"` // Who does this follow request originate from? Account *Account `bun:"rel:belongs-to"` // Account corresponding to accountID TargetAccountID string `bun:"type:CHAR(26),unique:frsrctarget,notnull,nullzero"` // Who is the target of this follow request? TargetAccount *Account `bun:"rel:belongs-to"` // Account corresponding to targetAccountID ShowReblogs *bool `bun:",nullzero,notnull,default:true"` // Does this follow also want to see reblogs and not just posts? Notify *bool `bun:",nullzero,notnull,default:false"` // does the following account want to be notified when the followed account posts? }
FollowRequest represents one account requesting to follow another, and the metadata around that request.
type FollowedTag ¶ added in v0.17.0
type FollowedTag struct { // ID of the account that follows the tag. AccountID string `bun:"type:CHAR(26),pk,nullzero"` // ID of the tag. TagID string `bun:"type:CHAR(26),pk,nullzero"` }
FollowedTag represents a user following a tag.
type HeaderFilter ¶ added in v0.14.0
type HeaderFilter struct { ID string `bun:"type:CHAR(26),pk,nullzero,notnull,unique"` // ID of this item in the database Header string `bun:",nullzero,notnull"` // Canonical request header this filter pertains to. Regex string `bun:",nullzero,notnull"` // Request header value matching regular expression. AuthorID string `bun:"type:CHAR(26),nullzero,notnull"` // Account ID of the creator of this filter Author *Account `bun:"-"` // Account corresponding to AuthorID CreatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item created UpdatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item last updated }
HeaderFilter represents an HTTP request filter in the database, with a header to match against, value matching regex, and details about its creation.
type HeaderFilterAllow ¶ added in v0.14.0
type HeaderFilterAllow struct{ HeaderFilter }
HeaderFilterAllow represents an allow HTTP header filter in the database.
type HeaderFilterBlock ¶ added in v0.14.0
type HeaderFilterBlock struct{ HeaderFilter }
HeaderFilterBlock represents a block HTTP header filter in the database.
type Instance ¶
type Instance struct { ID string `bun:"type:CHAR(26),pk,nullzero,notnull,unique"` // id of this item in the database CreatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item created UpdatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item last updated Domain string `bun:",nullzero,notnull,unique"` // Instance domain eg example.org Title string `bun:""` // Title of this instance as it would like to be displayed. URI string `bun:",nullzero,notnull,unique"` // base URI of this instance eg https://example.org SuspendedAt time.Time `bun:"type:timestamptz,nullzero"` // When was this instance suspended, if at all? DomainBlockID string `bun:"type:CHAR(26),nullzero"` // ID of any existing domain block for this instance in the database DomainBlock *DomainBlock `bun:"rel:belongs-to"` // Domain block corresponding to domainBlockID ShortDescription string `bun:""` // Short description of this instance ShortDescriptionText string `bun:""` // Raw text version of short description (before parsing). Description string `bun:""` // Longer description of this instance. DescriptionText string `bun:""` // Raw text version of long description (before parsing). Terms string `bun:""` // Terms and conditions of this instance. TermsText string `bun:""` // Raw text version of terms (before parsing). ContactEmail string `bun:""` // Contact email address for this instance ContactAccountUsername string `bun:",nullzero"` // Username of the contact account for this instance ContactAccountID string `bun:"type:CHAR(26),nullzero"` // Contact account ID in the database for this instance ContactAccount *Account `bun:"rel:belongs-to"` // account corresponding to contactAccountID Reputation int64 `bun:",notnull,default:0"` // Reputation score of this instance Version string `bun:",nullzero"` // Version of the software used on this instance Rules []Rule `bun:"-"` // List of instance rules }
Instance represents a federated instance, either local or remote.
type InteractionPolicy ¶ added in v0.17.0
type InteractionPolicy struct { // Conditions in which a Like // interaction will be accepted // for an item with this policy. CanLike PolicyRules // Conditions in which a Reply // interaction will be accepted // for an item with this policy. CanReply PolicyRules // Conditions in which an Announce // interaction will be accepted // for an item with this policy. CanAnnounce PolicyRules }
An InteractionPolicy determines which interactions will be accepted for an item, and according to what rules.
func DefaultInteractionPolicyDirect ¶ added in v0.17.0
func DefaultInteractionPolicyDirect() *InteractionPolicy
Returns the default interaction policy for a post with visibility of direct.
func DefaultInteractionPolicyFollowersOnly ¶ added in v0.17.0
func DefaultInteractionPolicyFollowersOnly() *InteractionPolicy
Returns the default interaction policy for a post with visibility of followers only.
func DefaultInteractionPolicyFor ¶ added in v0.17.0
func DefaultInteractionPolicyFor(v Visibility) *InteractionPolicy
Returns the default interaction policy for the given visibility level.
func DefaultInteractionPolicyPublic ¶ added in v0.17.0
func DefaultInteractionPolicyPublic() *InteractionPolicy
Returns the default interaction policy for a post with visibility of public.
func DefaultInteractionPolicyUnlocked ¶ added in v0.17.0
func DefaultInteractionPolicyUnlocked() *InteractionPolicy
Returns the default interaction policy for a post with visibility of unlocked.
type InteractionRequest ¶ added in v0.17.0
type InteractionRequest struct { ID string `bun:"type:CHAR(26),pk,nullzero,notnull,unique"` // id of this item in the database CreatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item created StatusID string `bun:"type:CHAR(26),nullzero,notnull"` // ID of the interaction target status. Status *Status `bun:"-"` // Not stored in DB. Status being interacted with. TargetAccountID string `bun:"type:CHAR(26),nullzero,notnull"` // id of the account being interacted with TargetAccount *Account `bun:"-"` // Not stored in DB. Account being interacted with. InteractingAccountID string `bun:"type:CHAR(26),nullzero,notnull"` // id of the account requesting the interaction. InteractingAccount *Account `bun:"-"` // Not stored in DB. Account corresponding to targetAccountID InteractionURI string `bun:",nullzero,notnull,unique"` // URI of the interacting like, reply, or announce. Unique (only one interaction request allowed per interaction URI). InteractionType InteractionType `bun:",notnull"` // One of Like, Reply, or Announce. Like *StatusFave `bun:"-"` // Not stored in DB. Only set if InteractionType = InteractionLike. Reply *Status `bun:"-"` // Not stored in DB. Only set if InteractionType = InteractionReply. Announce *Status `bun:"-"` // Not stored in DB. Only set if InteractionType = InteractionAnnounce. AcceptedAt time.Time `bun:"type:timestamptz,nullzero"` // If interaction request was accepted, time at which this occurred. RejectedAt time.Time `bun:"type:timestamptz,nullzero"` // If interaction request was rejected, time at which this occurred. // ActivityPub URI of the Accept (if accepted) or Reject (if rejected). // Field may be empty if currently neither accepted not rejected, or if // acceptance/rejection was implicit (ie., not resulting from an Activity). URI string `bun:",nullzero,unique"` }
InteractionRequest represents one interaction (like, reply, fave) that is either accepted, rejected, or currently still awaiting acceptance or rejection by the target account.
func (*InteractionRequest) IsAccepted ¶ added in v0.17.0
func (ir *InteractionRequest) IsAccepted() bool
IsAccepted returns true if this interaction request has been accepted.
func (*InteractionRequest) IsPending ¶ added in v0.17.0
func (ir *InteractionRequest) IsPending() bool
IsHandled returns true if interaction request has been neither accepted or rejected.
func (*InteractionRequest) IsRejected ¶ added in v0.17.0
func (ir *InteractionRequest) IsRejected() bool
IsRejected returns true if this interaction request has been rejected.
type InteractionType ¶ added in v0.17.0
type InteractionType int
Like / Reply / Announce
const ( InteractionLike InteractionType = iota InteractionReply InteractionAnnounce )
func (InteractionType) String ¶ added in v0.17.0
func (i InteractionType) String() string
Stringifies this InteractionType in a manner suitable for serving via the API.
type List ¶ added in v0.10.0
type List struct { ID string `bun:"type:CHAR(26),pk,nullzero,notnull,unique"` // id of this item in the database CreatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item created UpdatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item last updated Title string `bun:",nullzero,notnull,unique:listaccounttitle"` // Title of this list. AccountID string `bun:"type:CHAR(26),notnull,nullzero,unique:listaccounttitle"` // Account that created/owns the list Account *Account `bun:"-"` // Account corresponding to accountID RepliesPolicy RepliesPolicy `bun:",nullzero,notnull,default:'followed'"` // RepliesPolicy for this list. Exclusive *bool `bun:",nullzero,notnull,default:false"` // Hide posts from members of this list from your home timeline. }
List refers to a list of follows for which the owning account wants to view a timeline of posts.
type ListEntry ¶ added in v0.10.0
type ListEntry struct { ID string `bun:"type:CHAR(26),pk,nullzero,notnull,unique"` // id of this item in the database CreatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item created UpdatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item last updated ListID string `bun:"type:CHAR(26),notnull,nullzero,unique:listentrylistfollow"` // ID of the list that this entry belongs to. FollowID string `bun:"type:CHAR(26),notnull,nullzero,unique:listentrylistfollow"` // Follow that the account owning this entry wants to see posts of in the timeline. Follow *Follow `bun:"-"` // Follow corresponding to followID. }
ListEntry refers to a single follow entry in a list.
type Marker ¶ added in v0.11.0
type Marker struct { AccountID string `bun:"type:CHAR(26),pk,unique:markers_account_id_timeline_uniq,notnull,nullzero"` // ID of the local account that owns the marker Name MarkerName `bun:",nullzero,notnull,pk,unique:markers_account_id_timeline_uniq"` // Name of the marked timeline UpdatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // When marker was last updated Version int `bun:",nullzero,notnull,default:0"` // For optimistic concurrency control LastReadID string `bun:"type:CHAR(26),notnull,nullzero"` // Last ID read on this timeline (status ID for home, notification ID for notifications) }
Marker stores a local account's read position on a given timeline.
type MarkerName ¶ added in v0.11.0
type MarkerName string
MarkerName is the name of one of the timelines we can store markers for.
const ( MarkerNameHome MarkerName = "home" MarkerNameNotifications MarkerName = "notifications" )
type MediaAttachment ¶
type MediaAttachment struct { ID string `bun:"type:CHAR(26),pk,nullzero,notnull,unique"` // id of this item in the database CreatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item created UpdatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item last updated StatusID string `bun:"type:CHAR(26),nullzero"` // ID of the status to which this is attached URL string `bun:",nullzero"` // Where can the attachment be retrieved on *this* server RemoteURL string `bun:",nullzero"` // Where can the attachment be retrieved on a remote server (empty for local media) Type FileType `bun:",notnull,default:0"` // Type of file (image/gifv/audio/video/unknown) FileMeta FileMeta `bun:",embed:,notnull"` // Metadata about the file AccountID string `bun:"type:CHAR(26),nullzero,notnull"` // To which account does this attachment belong Description string `bun:""` // Description of the attachment (for screenreaders) ScheduledStatusID string `bun:"type:CHAR(26),nullzero"` // To which scheduled status does this attachment belong Blurhash string `bun:",nullzero"` // What is the generated blurhash of this attachment Processing ProcessingStatus `bun:",notnull,default:2"` // What is the processing status of this attachment File File `bun:",embed:file_,notnull,nullzero"` // metadata for the whole file Thumbnail Thumbnail `bun:",embed:thumbnail_,notnull,nullzero"` // small image thumbnail derived from a larger image, video, or audio file. Avatar *bool `bun:",nullzero,notnull,default:false"` // Is this attachment being used as an avatar? Header *bool `bun:",nullzero,notnull,default:false"` // Is this attachment being used as a header? Cached *bool `bun:",nullzero,notnull,default:false"` // Is this attachment currently cached by our instance? }
MediaAttachment represents a user-uploaded media attachment: an image/video/audio/gif that is somewhere in storage and that can be retrieved and served by the router.
func (*MediaAttachment) IsLocal ¶ added in v0.17.0
func (m *MediaAttachment) IsLocal() bool
IsLocal returns whether media attachment is local.
func (*MediaAttachment) IsRemote ¶ added in v0.17.0
func (m *MediaAttachment) IsRemote() bool
IsRemote returns whether media attachment is remote.
type Mention ¶
type Mention struct { ID string `bun:"type:CHAR(26),pk,nullzero,notnull,unique"` // id of this item in the database CreatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item created UpdatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item last updated StatusID string `bun:"type:CHAR(26),nullzero,notnull"` // ID of the status this mention originates from Status *Status `bun:"rel:belongs-to"` // status referred to by statusID OriginAccountID string `bun:"type:CHAR(26),nullzero,notnull"` // ID of the mention creator account OriginAccountURI string `bun:",nullzero,notnull"` // ActivityPub URI of the originator/creator of the mention OriginAccount *Account `bun:"rel:belongs-to"` // account referred to by originAccountID TargetAccountID string `bun:"type:CHAR(26),nullzero,notnull"` // Mention target/receiver account ID TargetAccount *Account `bun:"rel:belongs-to"` // account referred to by targetAccountID Silent *bool `bun:",nullzero,notnull,default:false"` // Prevent this mention from generating a notification? // NameString is for putting in the namestring of the mentioned user // before the mention is dereferenced. Should be in a form along the lines of: // @whatever_username@example.org // // This will not be put in the database, it's just for convenience. NameString string `bun:"-"` // TargetAccountURI is the AP ID (uri) of the user mentioned. // // This will not be put in the database, it's just for convenience. TargetAccountURI string `bun:"-"` // TargetAccountURL is the web url of the user mentioned. // // This will not be put in the database, it's just for convenience. TargetAccountURL string `bun:"-"` }
Mention refers to the 'tagging' or 'mention' of a user within a status.
type Move ¶ added in v0.15.0
type Move struct { ID string `bun:"type:CHAR(26),pk,nullzero,notnull,unique"` // ID of this item in the database. CreatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // When was item created. UpdatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // When was item last updated. AttemptedAt time.Time `bun:"type:timestamptz,nullzero"` // When was processing of the Move to TargetURI last attempted by our instance (zero if not yet attempted). SucceededAt time.Time `bun:"type:timestamptz,nullzero"` // When did the processing of the Move to TargetURI succeed according to our criteria (zero if not yet complete). OriginURI string `bun:",nullzero,notnull,unique:moveorigintarget"` // OriginURI of the Move. Ie., the Move Object. Origin *url.URL `bun:"-"` // URL corresponding to OriginURI. Not stored in the database. TargetURI string `bun:",nullzero,notnull,unique:moveorigintarget"` // TargetURI of the Move. Ie., the Move Target. Target *url.URL `bun:"-"` // URL corresponding to TargetURI. Not stored in the database. URI string `bun:",nullzero,notnull,unique"` // ActivityPub ID/URI of the Move Activity itself. }
Move represents an ActivityPub "Move" activity received (or created) by this instance.
type NewSignup ¶ added in v0.11.0
type NewSignup struct { Username string // Username of the new account (required). Email string // Email address of the user (required). Password string // Plaintext (not yet hashed) password for the user (required). Reason string // Reason given by the user when submitting a sign up request (optional). PreApproved bool // Mark the new user/account as preapproved (optional) SignUpIP net.IP // IP address from which the sign up request occurred (optional). Locale string // Locale code for the new account/user (optional). AppID string // ID of the application used to create this account (optional). EmailVerified bool // Mark submitted email address as already verified (optional). ExternalID string // ID of this user in external OIDC system (optional). Admin bool // Mark new user as an admin user (optional). }
NewSignup models parameters for the creation of a new user + account on this instance.
Aside from username, email, and password, it is fine to use zero values on fields of this struct.
This struct is not stored in the database, it's just for passing around parameters.
type Notification ¶
type Notification struct { ID string `bun:"type:CHAR(26),pk,nullzero,notnull,unique"` // id of this item in the database CreatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item created UpdatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item last updated NotificationType NotificationType `bun:",nullzero,notnull"` // Type of this notification TargetAccountID string `bun:"type:CHAR(26),nullzero,notnull"` // ID of the account targeted by the notification (ie., who will receive the notification?) TargetAccount *Account `bun:"-"` // Account corresponding to TargetAccountID. Can be nil, always check first + select using ID if necessary. OriginAccountID string `bun:"type:CHAR(26),nullzero,notnull"` // ID of the account that performed the action that created the notification. OriginAccount *Account `bun:"-"` // Account corresponding to OriginAccountID. Can be nil, always check first + select using ID if necessary. StatusID string `bun:"type:CHAR(26),nullzero"` // If the notification pertains to a status, what is the database ID of that status? Status *Status `bun:"-"` // Status corresponding to StatusID. Can be nil, always check first + select using ID if necessary. Read *bool `bun:",nullzero,notnull,default:false"` // Notification has been seen/read }
Notification models an alert/notification sent to an account about something like a reblog, like, new follow request, etc.
type NotificationType ¶
type NotificationType string
NotificationType describes the reason/type of this notification.
const ( NotificationFollow NotificationType = "follow" // NotificationFollow -- someone followed you NotificationFollowRequest NotificationType = "follow_request" // NotificationFollowRequest -- someone requested to follow you NotificationMention NotificationType = "mention" // NotificationMention -- someone mentioned you in their status NotificationReblog NotificationType = "reblog" // NotificationReblog -- someone boosted one of your statuses NotificationFave NotificationType = "favourite" // NotificationFave -- someone faved/liked one of your statuses NotificationPoll NotificationType = "poll" // NotificationPoll -- a poll you voted in or created has ended NotificationStatus NotificationType = "status" // NotificationStatus -- someone you enabled notifications for has posted a status. NotificationSignup NotificationType = "admin.sign_up" // NotificationSignup -- someone has submitted a new account sign-up to the instance. NotificationPendingFave NotificationType = "pending.favourite" // Someone has faved a status of yours, which requires approval by you. NotificationPendingReply NotificationType = "pending.reply" // Someone has replied to a status of yours, which requires approval by you. NotificationPendingReblog NotificationType = "pending.reblog" // Someone has boosted a status of yours, which requires approval by you. )
Notification Types
type Original ¶
type Original struct { Width int // width in pixels Height int // height in pixels Size int // size in pixels (width * height) Aspect float32 // aspect ratio (width / height) Duration *float32 // video-specific: duration of the video in seconds Framerate *float32 // video-specific: fps Bitrate *uint64 // video-specific: bitrate }
Original can be used for original metadata for any media type
type ParseMentionFunc ¶ added in v0.2.2
type ParseMentionFunc func(ctx context.Context, namestring string, originAccountID string, statusID string) (*Mention, error)
ParseMentionFunc describes a function that takes a lowercase account namestring in the form "@test@whatever.example.org" for a remote account, or "@test" for a local account, and returns a fully populated mention for that account, with the given origin status ID and origin account ID.
If the account is remote and not yet found in the database, then ParseMentionFunc will try to webfinger the remote account and put it in the database before returning.
Mentions generated by this function are not put in the database, that's still up to the caller to do.
type PolicyCheckResult ¶ added in v0.17.0
type PolicyCheckResult struct { // Permission permitted / // with approval / forbidden. Permission PolicyPermission // Value that this check matched on. // Only set if Permission = permitted. PermittedMatchedOn *PolicyValue }
PolicyCheckResult encapsulates the results of checking a certain Actor URI + type of interaction against an interaction policy.
func (*PolicyCheckResult) Forbidden ¶ added in v0.17.0
func (pcr *PolicyCheckResult) Forbidden() bool
Permitted returns true if this policy check resulted in Permission = forbidden.
func (*PolicyCheckResult) MatchedOnCollection ¶ added in v0.17.0
func (pcr *PolicyCheckResult) MatchedOnCollection() bool
MatchedOnCollection returns true if this policy check result turned up Permitted, and matched based on the requester's presence in a followers or following collection.
func (*PolicyCheckResult) Permitted ¶ added in v0.17.0
func (pcr *PolicyCheckResult) Permitted() bool
Permitted returns true if this policy check resulted in Permission = permitted.
func (*PolicyCheckResult) WithApproval ¶ added in v0.17.0
func (pcr *PolicyCheckResult) WithApproval() bool
Permitted returns true if this policy check resulted in Permission = with approval.
type PolicyPermission ¶ added in v0.17.0
type PolicyPermission int
PolicyPermission represents the permission state for a certain Actor URI and interaction type, in relation to a policy.
const ( // Interaction is forbidden for this // PolicyValue + interaction combination. PolicyPermissionForbidden PolicyPermission = iota // Interaction is conditionally permitted // for this PolicyValue + interaction combo, // pending approval by the item owner. PolicyPermissionWithApproval // Interaction is permitted for this // PolicyValue + interaction combination. PolicyPermissionPermitted )
type PolicyRules ¶ added in v0.17.0
type PolicyRules struct { // Always is for PolicyValues who are // permitted to do an interaction // without requiring approval. Always PolicyValues // WithApproval is for PolicyValues who // are conditionally permitted to do // an interaction, pending approval. WithApproval PolicyValues }
PolicyRules represents the rules according to which a certain interaction is permitted to various Actor and Actor Collection URIs.
type PolicyValue ¶ added in v0.17.0
type PolicyValue string
A policy URI is GoToSocial's internal representation of one ActivityPub URI for an Actor or a Collection of Actors, specific to the domain of enforcing interaction policies.
A PolicyValue can be stored in the database either as one of the Value constants defined below (to save space), OR as a full-fledged ActivityPub URI.
A PolicyValue should be translated to the canonical string value of the represented URI when federating an item, or from the canonical string value of the URI when receiving or retrieving an item.
For example, if the PolicyValue `followers` was being federated outwards in an interaction policy attached to an item created by the actor `https://example.org/users/someone`, then it should be translated to their followers URI when sent, eg., `https://example.org/users/someone/followers`.
Likewise, if GoToSocial receives an item with an interaction policy containing `https://example.org/users/someone/followers`, and the item was created by `https://example.org/users/someone`, then the followers URI would be converted to `followers` for internal storage.
const ( // Stand-in for ActivityPub magic public URI, // which encompasses every possible Actor URI. PolicyValuePublic PolicyValue = "public" // Stand-in for the Followers Collection of // the item owner's Actor. PolicyValueFollowers PolicyValue = "followers" // Stand-in for the Following Collection of // the item owner's Actor. PolicyValueFollowing PolicyValue = "following" // Stand-in for the Mutuals Collection of // the item owner's Actor. // // (TODO: Reserved, currently unused). PolicyValueMutuals PolicyValue = "mutuals" // Stand-in for Actor URIs tagged in the item. PolicyValueMentioned PolicyValue = "mentioned" // Stand-in for the Actor URI of the item owner. PolicyValueAuthor PolicyValue = "author" )
func (PolicyValue) FeasibleForVisibility ¶ added in v0.17.0
func (p PolicyValue) FeasibleForVisibility(v Visibility) bool
FeasibleForVisibility returns true if the PolicyValue could feasibly be set in a policy for an item with the given visibility, otherwise returns false.
For example, PolicyValuePublic could not be set in a policy for an item with visibility FollowersOnly, but could be set in a policy for an item with visibility Public or Unlocked.
This is not prescriptive, and should be used only to guide policy choices. Eg., if a remote instance wants to do something wacky like set "anyone can interact with this status" for a Direct visibility status, that's their business; our normal visibility filtering will prevent users on our instance from actually being able to interact unless they can see the status anyway.
type PolicyValues ¶ added in v0.17.0
type PolicyValues []PolicyValue
type Poll ¶ added in v0.13.0
type Poll struct { ID string `bun:"type:CHAR(26),pk,nullzero,notnull,unique"` // Unique identity string. Multiple *bool `bun:",nullzero,notnull,default:false"` // Is this a multiple choice poll? i.e. can you vote on multiple options. HideCounts *bool `bun:",nullzero,notnull,default:false"` // Hides vote counts until poll ends. Options []string `bun:",nullzero,notnull"` // The available options for this poll. Votes []int `bun:",nullzero,notnull"` // Vote counts per choice. Voters *int `bun:",nullzero,notnull"` // Total no. voters count. StatusID string `bun:"type:CHAR(26),nullzero,notnull,unique"` // Status ID of which this Poll is attached to. Status *Status `bun:"-"` // The related Status for StatusID (not always set). ExpiresAt time.Time `bun:"type:timestamptz,nullzero"` // The expiry date of this Poll, will be zerotime until set. (local polls ALWAYS have this set). ClosedAt time.Time `bun:"type:timestamptz,nullzero"` // The closure date of this poll, anything other than zerotime indicates closed. Closing bool `bun:"-"` // An ephemeral field only set on Polls in the middle of closing. }
Poll represents an attached (to) Status poll, i.e. a questionaire. Can be remote / local.
func (*Poll) CheckVotes ¶ added in v0.13.0
func (p *Poll) CheckVotes()
CheckVotes ensures that the Poll.Votes slice is not nil, else initializing an int slice len+cap equal to Poll.Options. Note this should not be needed anywhere other than the database and the processor.
func (*Poll) Closed ¶ added in v0.13.0
Closed returns whether the Poll is closed (i.e. date is set and BEFORE now).
func (*Poll) DecrementVotes ¶ added in v0.13.0
DecrementVotes decrements Poll vote and voter counts for given choices.
func (*Poll) Expired ¶ added in v0.13.0
Expired returns whether the Poll is expired (i.e. date is BEFORE now).
func (*Poll) IncrementVotes ¶ added in v0.13.0
IncrementVotes increments Poll vote and voter counts for given choices.
func (*Poll) ResetVotes ¶ added in v0.13.0
func (p *Poll) ResetVotes()
ResetVotes resets all stored vote counts.
type PollVote ¶ added in v0.13.0
type PollVote struct { ID string `bun:"type:CHAR(26),pk,nullzero,notnull,unique"` // Unique identity string. Choices []int `bun:",nullzero,notnull"` // The Poll's option indices of which these are votes for. AccountID string `bun:"type:CHAR(26),nullzero,notnull,unique:in_poll_by_account"` // Account ID from which this vote originated. Account *Account `bun:"-"` // The related Account for AccountID (not always set). PollID string `bun:"type:CHAR(26),nullzero,notnull,unique:in_poll_by_account"` // Poll ID of which this is a vote in. Poll *Poll `bun:"-"` // The related Poll for PollID (not always set). CreatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // The creation date of this PollVote. }
PollVote represents a single instance of vote(s) in a Poll by an account. If the Poll is single-choice, len(.Choices) = 1, if multiple-choice then len(.Choices) >= 1. Can be remote or local.
type ProcessingStatus ¶
type ProcessingStatus int
ProcessingStatus refers to how far along in the processing stage the attachment is.
const ( ProcessingStatusReceived ProcessingStatus = 0 // ProcessingStatusReceived indicates the attachment has been received and is awaiting processing. No thumbnail available yet. ProcessingStatusProcessing ProcessingStatus = 1 // ProcessingStatusProcessing indicates the attachment is currently being processed. Thumbnail is available but full media is not. ProcessingStatusProcessed ProcessingStatus = 2 // ProcessingStatusProcessed indicates the attachment has been fully processed and is ready to be served. ProcessingStatusError ProcessingStatus = 666 // ProcessingStatusError indicates something went wrong processing the attachment and it won't be tried again--these can be deleted. )
MediaAttachment processing states.
type Relationship ¶
type Relationship struct { ID string // The account id. Following bool // Are you following this user? ShowingReblogs bool // Are you receiving this user's boosts in your home timeline? Notifying bool // Have you enabled notifications for this user? FollowedBy bool // Are you followed by this user? Blocking bool // Are you blocking this user? BlockedBy bool // Is this user blocking you? Muting bool // Are you muting this user? MutingNotifications bool // Are you muting notifications from this user? Requested bool // Do you have a pending follow request targeting this user? RequestedBy bool // Does the user have a pending follow request targeting you? DomainBlocking bool // Are you blocking this user's domain? Endorsed bool // Are you featuring this user on your profile? Note string // Your note on this account. }
Relationship describes a requester's relationship with another account.
type RepliesPolicy ¶ added in v0.10.0
type RepliesPolicy string
RepliesPolicy denotes which replies should be shown in the list.
const ( RepliesPolicyFollowed RepliesPolicy = "followed" // Show replies to any followed user. RepliesPolicyList RepliesPolicy = "list" // Show replies to members of the list only. RepliesPolicyNone RepliesPolicy = "none" // Don't show replies. )
type Report ¶ added in v0.7.0
type Report struct { ID string `bun:"type:CHAR(26),pk,nullzero,notnull,unique"` // id of this item in the database CreatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item created UpdatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item last updated URI string `bun:",unique,nullzero,notnull"` // activitypub URI of this report AccountID string `bun:"type:CHAR(26),nullzero,notnull"` // which account created this report Account *Account `bun:"-"` // account corresponding to AccountID TargetAccountID string `bun:"type:CHAR(26),nullzero,notnull"` // which account is targeted by this report TargetAccount *Account `bun:"-"` // account corresponding to TargetAccountID Comment string `bun:",nullzero"` // comment / explanation for this report, by the reporter StatusIDs []string `bun:"statuses,array"` // database IDs of any statuses referenced by this report Statuses []*Status `bun:"-"` // statuses corresponding to StatusIDs RuleIDs []string `bun:"rules,array"` // database IDs of any rules referenced by this report Rules []*Rule `bun:"-"` // rules corresponding to RuleIDs Forwarded *bool `bun:",nullzero,notnull,default:false"` // flag to indicate report should be forwarded to remote instance ActionTaken string `bun:",nullzero"` // string description of what action was taken in response to this report ActionTakenAt time.Time `bun:"type:timestamptz,nullzero"` // time at which action was taken, if any ActionTakenByAccountID string `bun:"type:CHAR(26),nullzero"` // database ID of account which took action, if any ActionTakenByAccount *Account `bun:"-"` // account corresponding to ActionTakenByID, if any }
Report models a user-created reported about an account, which should be reviewed and acted upon by instance admins.
This can be either a report created locally (on this instance) about a user on this or another instance, OR a report that was created remotely (on another instance) about a user on this instance, and received via the federated (s2s) API.
type RouterSession ¶
type RouterSession struct { ID string `bun:"type:CHAR(26),pk,nullzero,notnull,unique"` // id of this item in the database CreatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item created UpdatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item last updated Auth []byte `bun:"type:bytea,notnull,nullzero"` Crypt []byte `bun:"type:bytea,notnull,nullzero"` }
RouterSession is used to store and retrieve settings for a router session.
type Rule ¶ added in v0.12.0
type Rule struct { ID string `bun:"type:CHAR(26),pk,nullzero,notnull,unique"` // id of this item in the database CreatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item created UpdatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item last updated Text string `bun:",nullzero"` // text content of the rule Order *uint `bun:",nullzero,notnull,unique"` // rule ordering, index from 0 Deleted *bool `bun:",nullzero,notnull,default:false"` // has this rule been deleted, still kept in database for reference in historic reports }
Rule models an instance rule set by the admin
type SinBinStatus ¶ added in v0.17.0
type SinBinStatus struct { ID string `bun:"type:CHAR(26),pk,nullzero,notnull,unique"` // ID of this item in the database. CreatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // Creation time of this item. UpdatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // Last-updated time of this item. URI string `bun:",unique,nullzero,notnull"` // ActivityPub URI/ID of this status. URL string `bun:",nullzero"` // Web url for viewing this status. Domain string `bun:",nullzero"` // Domain of the status, will be null if this is a local status, otherwise something like `example.org`. AccountURI string `bun:",nullzero,notnull"` // ActivityPub uri of the author of this status. InReplyToURI string `bun:",nullzero"` // ActivityPub uri of the status this status is a reply to. Content string `bun:",nullzero"` // Content of this status. AttachmentLinks []string `bun:",nullzero,array"` // Links to attachments of this status. MentionTargetURIs []string `bun:",nullzero,array"` // URIs of mentioned accounts. EmojiLinks []string `bun:",nullzero,array"` // Links to any emoji images used in this status. PollOptions []string `bun:",nullzero,array"` // String values of any poll options used in this status. ContentWarning string `bun:",nullzero"` // CW / subject string for this status. Visibility Visibility `bun:",nullzero,notnull"` // Visibility level of this status. Sensitive *bool `bun:",nullzero,notnull,default:false"` // Mark the status as sensitive. Language string `bun:",nullzero"` // Language code for this status. ActivityStreamsType string `bun:",nullzero,notnull"` // ActivityStreams type of this status. }
SinBinStatus represents a status that's been rejected and/or reported + quarantined.
Automatically rejected statuses are not put in the sin bin, only statuses that were stored on the instance and which someone (local or remote) has subsequently rejected.
type Small ¶
type Small struct { Width int // width in pixels Height int // height in pixels Size int // size in pixels (width * height) Aspect float32 // aspect ratio (width / height) }
Small can be used for a thumbnail of any media type
type Status ¶
type Status struct { ID string `bun:"type:CHAR(26),pk,nullzero,notnull,unique"` // id of this item in the database CreatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item created UpdatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item last updated FetchedAt time.Time `bun:"type:timestamptz,nullzero"` // when was item (remote) last fetched. PinnedAt time.Time `bun:"type:timestamptz,nullzero"` // Status was pinned by owning account at this time. URI string `bun:",unique,nullzero,notnull"` // activitypub URI of this status URL string `bun:",nullzero"` // web url for viewing this status Content string `bun:""` // content of this status; likely html-formatted but not guaranteed AttachmentIDs []string `bun:"attachments,array"` // Database IDs of any media attachments associated with this status Attachments []*MediaAttachment `bun:"attached_media,rel:has-many"` // Attachments corresponding to attachmentIDs TagIDs []string `bun:"tags,array"` // Database IDs of any tags used in this status Tags []*Tag `bun:"attached_tags,m2m:status_to_tags"` // Tags corresponding to tagIDs. https://bun.uptrace.dev/guide/relations.html#many-to-many-relation MentionIDs []string `bun:"mentions,array"` // Database IDs of any mentions in this status Mentions []*Mention `bun:"attached_mentions,rel:has-many"` // Mentions corresponding to mentionIDs EmojiIDs []string `bun:"emojis,array"` // Database IDs of any emojis used in this status Emojis []*Emoji `bun:"attached_emojis,m2m:status_to_emojis"` // Emojis corresponding to emojiIDs. https://bun.uptrace.dev/guide/relations.html#many-to-many-relation Local *bool `bun:",nullzero,notnull,default:false"` // is this status from a local account? AccountID string `bun:"type:CHAR(26),nullzero,notnull"` // which account posted this status? Account *Account `bun:"rel:belongs-to"` // account corresponding to accountID AccountURI string `bun:",nullzero,notnull"` // activitypub uri of the owner of this status InReplyToID string `bun:"type:CHAR(26),nullzero"` // id of the status this status replies to InReplyToURI string `bun:",nullzero"` // activitypub uri of the status this status is a reply to InReplyToAccountID string `bun:"type:CHAR(26),nullzero"` // id of the account that this status replies to InReplyTo *Status `bun:"-"` // status corresponding to inReplyToID InReplyToAccount *Account `bun:"rel:belongs-to"` // account corresponding to inReplyToAccountID BoostOfID string `bun:"type:CHAR(26),nullzero"` // id of the status this status is a boost of BoostOfURI string `bun:"-"` // URI of the status this status is a boost of; field not inserted in the db, just for dereferencing purposes. BoostOfAccountID string `bun:"type:CHAR(26),nullzero"` // id of the account that owns the boosted status BoostOf *Status `bun:"-"` // status that corresponds to boostOfID BoostOfAccount *Account `bun:"rel:belongs-to"` // account that corresponds to boostOfAccountID ThreadID string `bun:"type:CHAR(26),nullzero"` // id of the thread to which this status belongs; only set for remote statuses if a local account is involved at some point in the thread, otherwise null PollID string `bun:"type:CHAR(26),nullzero"` // Poll *Poll `bun:"-"` // ContentWarning string `bun:",nullzero"` // cw string for this status Visibility Visibility `bun:",nullzero,notnull"` // visibility entry for this status Sensitive *bool `bun:",nullzero,notnull,default:false"` // mark the status as sensitive? Language string `bun:",nullzero"` // what language is this status written in? CreatedWithApplicationID string `bun:"type:CHAR(26),nullzero"` // Which application was used to create this status? CreatedWithApplication *Application `bun:"rel:belongs-to"` // application corresponding to createdWithApplicationID ActivityStreamsType string `bun:",nullzero,notnull"` // What is the activitystreams type of this status? See: https://www.w3.org/TR/activitystreams-vocabulary/#object-types. Will probably almost always be Note but who knows!. Text string `bun:""` // Original text of the status without formatting Federated *bool `bun:",notnull"` // This status will be federated beyond the local timeline(s) InteractionPolicy *InteractionPolicy `bun:""` // InteractionPolicy for this status. If null then the default InteractionPolicy should be assumed for this status's Visibility. Always null for boost wrappers. PendingApproval *bool `bun:",nullzero,notnull,default:false"` // If true then status is a reply or boost wrapper that must be Approved by the reply-ee or boost-ee before being fully distributed. PreApproved bool `bun:"-"` // If true, then status is a reply to or boost wrapper of a status on our instance, has permission to do the interaction, and an Accept should be sent out for it immediately. Field not stored in the DB. ApprovedByURI string `bun:",nullzero"` // URI of an Accept Activity that approves the Announce or Create Activity that this status was/will be attached to. }
Status represents a user-created 'post' or 'status' in the database, either remote or local
func (*Status) AttachmentsPopulated ¶ added in v0.8.0
AttachmentsPopulated returns whether media attachments are populated according to current AttachmentIDs.
func (*Status) BelongsToAccount ¶ added in v0.13.0
BelongsToAccount returns whether status belongs to the given account ID.
func (*Status) EmojisPopulated ¶ added in v0.8.0
EmojisPopulated returns whether emojis are populated according to current EmojiIDs.
func (*Status) EmojisUpToDate ¶ added in v0.9.0
EmojissUpToDate returns whether status emoji attachments of receiving status are up-to-date according to emoji attachments of the passed status, by comparing their emoji URIs. We don't use IDs as this is used to determine whether there are new emojis to fetch.
func (*Status) GetAccountID ¶ added in v0.2.0
GetAccountID implements timeline.Timelineable{}.
func (*Status) GetAttachmentByRemoteURL ¶ added in v0.9.0
func (s *Status) GetAttachmentByRemoteURL(url string) (*MediaAttachment, bool)
GetAttachmentByRemoteURL searches status for MediaAttachment{} with remote URL.
func (*Status) GetBoostOfAccountID ¶ added in v0.2.0
GetBoostOfAccountID implements timeline.Timelineable{}.
func (*Status) GetBoostOfID ¶ added in v0.2.0
GetBoostID implements timeline.Timelineable{}.
func (*Status) GetMentionByTargetURI ¶ added in v0.9.0
GetMentionByTargetURI searches status for Mention{} with target URI.
func (*Status) GetMentionByUsernameDomain ¶ added in v0.17.0
GetMentionByUsernameDomain fetches the Mention associated with given username and domains, typically extracted from a mention Namestring.
func (*Status) GetTagByName ¶ added in v0.13.0
GetTagByName searches status for Tag{} with name.
func (*Status) IsLocal ¶ added in v0.14.0
IsLocal returns true if this is a local status (ie., originating from this instance).
func (*Status) IsLocalOnly ¶ added in v0.17.0
IsLocalOnly returns true if this status is "local-only" ie., unfederated.
func (*Status) MentionsAccount ¶ added in v0.8.0
MentionsAccount returns whether status mentions the given account ID.
func (*Status) MentionsPopulated ¶ added in v0.8.0
MentionsPopulated returns whether mentions are populated according to current MentionIDs.
func (*Status) TagsPopulated ¶ added in v0.8.0
TagsPopulated returns whether tags are populated according to current TagIDs.
type StatusBookmark ¶
type StatusBookmark struct { ID string `bun:"type:CHAR(26),pk,nullzero,notnull,unique"` // id of this item in the database CreatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item created UpdatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item last updated AccountID string `bun:"type:CHAR(26),nullzero,notnull"` // id of the account that created ('did') the bookmark Account *Account `bun:"rel:belongs-to"` // account that created the bookmark TargetAccountID string `bun:"type:CHAR(26),nullzero,notnull"` // id the account owning the bookmarked status TargetAccount *Account `bun:"rel:belongs-to"` // account owning the bookmarked status StatusID string `bun:"type:CHAR(26),nullzero,notnull"` // database id of the status that has been bookmarked Status *Status `bun:"rel:belongs-to"` // the bookmarked status }
StatusBookmark refers to one account having a 'bookmark' of the status of another account.
type StatusFave ¶
type StatusFave struct { ID string `bun:"type:CHAR(26),pk,nullzero,notnull,unique"` // id of this item in the database CreatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item created UpdatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item last updated AccountID string `bun:"type:CHAR(26),unique:statusfaveaccountstatus,nullzero,notnull"` // id of the account that created ('did') the fave Account *Account `bun:"-"` // account that created the fave TargetAccountID string `bun:"type:CHAR(26),nullzero,notnull"` // id the account owning the faved status TargetAccount *Account `bun:"-"` // account owning the faved status StatusID string `bun:"type:CHAR(26),unique:statusfaveaccountstatus,nullzero,notnull"` // database id of the status that has been 'faved' Status *Status `bun:"-"` // the faved status URI string `bun:",nullzero,notnull,unique"` // ActivityPub URI of this fave PendingApproval *bool `bun:",nullzero,notnull,default:false"` // If true then Like must be Approved by the like-ee before being fully distributed. PreApproved bool `bun:"-"` // If true, then fave targets a status on our instance, has permission to do the interaction, and an Accept should be sent out for it immediately. Field not stored in the DB. ApprovedByURI string `bun:",nullzero"` // URI of an Accept Activity that approves this Like. }
StatusFave refers to a 'fave' or 'like' in the database, from one account, targeting the status of another account
type StatusMute ¶
type StatusMute struct { ID string `bun:"type:CHAR(26),pk,nullzero,notnull,unique"` // id of this item in the database CreatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item created UpdatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item last updated AccountID string `bun:"type:CHAR(26),nullzero,notnull"` // id of the account that created ('did') the mute Account *Account `bun:"rel:belongs-to"` // pointer to the account specified by accountID TargetAccountID string `bun:"type:CHAR(26),nullzero,notnull"` // id the account owning the muted status (can be the same as accountID) TargetAccount *Account `bun:"rel:belongs-to"` // pointer to the account specified by targetAccountID StatusID string `bun:"type:CHAR(26),nullzero,notnull"` // database id of the status that has been muted Status *Status `bun:"rel:belongs-to"` // pointer to the muted status specified by statusID }
StatusMute IS DEPRECATED -- USE THREADMUTE INSTEAD NOW! THIS TABLE DOESN'T EXIST ANYMORE!
type StatusToEmoji ¶
type StatusToEmoji struct { StatusID string `bun:"type:CHAR(26),unique:statusemoji,nullzero,notnull"` Status *Status `bun:"rel:belongs-to"` EmojiID string `bun:"type:CHAR(26),unique:statusemoji,nullzero,notnull"` Emoji *Emoji `bun:"rel:belongs-to"` }
StatusToEmoji is an intermediate struct to facilitate the many2many relationship between a status and one or more emojis.
type StatusToTag ¶
type StatusToTag struct { StatusID string `bun:"type:CHAR(26),unique:statustag,nullzero,notnull"` Status *Status `bun:"rel:belongs-to"` TagID string `bun:"type:CHAR(26),unique:statustag,nullzero,notnull"` Tag *Tag `bun:"rel:belongs-to"` }
StatusToTag is an intermediate struct to facilitate the many2many relationship between a status and one or more tags.
type Tag ¶
type Tag struct { ID string `bun:"type:CHAR(26),pk,nullzero,notnull,unique"` // id of this item in the database CreatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item created UpdatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item last updated Name string `bun:",unique,nullzero,notnull"` // (lowercase) name of the tag without the hash prefix Useable *bool `bun:",nullzero,notnull,default:true"` // Tag is useable on this instance. Listable *bool `bun:",nullzero,notnull,default:true"` // Tagged statuses can be listed on this instance. Href string `bun:"-"` // Href of the hashtag. Will only be set on freshly-extracted hashtags from remote AP messages. Not stored in the database. }
Tag represents a hashtag for gathering public statuses together.
type Theme ¶ added in v0.15.0
type Theme struct { // User-facing title of this theme. Title string // User-facing description of this theme. Description string // FileName of this theme in the themes // directory (eg., `light-blurple.css`). FileName string }
Theme represents a user-selected CSS theme for an account.
type Thread ¶ added in v0.13.0
type Thread struct { ID string `bun:"type:CHAR(26),pk,nullzero,notnull,unique"` // id of this item in the database StatusIDs []string `bun:"-"` // ids of statuses belonging to this thread (order not guaranteed) }
Thread represents one thread of statuses. TODO: add more fields here if necessary.
type ThreadMute ¶ added in v0.13.0
type ThreadMute struct { ID string `bun:"type:CHAR(26),pk,nullzero,notnull,unique"` // id of this item in the database CreatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item created UpdatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item last updated ThreadID string `bun:"type:CHAR(26),nullzero,notnull,unique:thread_mute_thread_id_account_id"` // ID of the muted thread AccountID string `bun:"type:CHAR(26),nullzero,notnull,unique:thread_mute_thread_id_account_id"` // Account ID of the creator of this mute }
ThreadMute represents an account-level mute of a thread of statuses.
type ThreadToStatus ¶ added in v0.13.0
type ThreadToStatus struct { ThreadID string `bun:"type:CHAR(26),unique:statusthread,nullzero,notnull"` StatusID string `bun:"type:CHAR(26),unique:statusthread,nullzero,notnull"` }
ThreadToStatus is an intermediate struct to facilitate the many2many relationship between a thread and one or more statuses.
type Thumbnail ¶
type Thumbnail struct { Path string `bun:",notnull"` // Path of the file in storage. ContentType string `bun:",notnull"` // MIME content type of the file. FileSize int `bun:",notnull"` // File size in bytes URL string `bun:",nullzero"` // What is the URL of the thumbnail on the local server RemoteURL string `bun:",nullzero"` // What is the remote URL of the thumbnail (empty for local media) }
Thumbnail refers to a small image thumbnail derived from a larger image, video, or audio file.
type Token ¶
type Token struct { ID string `bun:"type:CHAR(26),pk,nullzero,notnull,unique"` // id of this item in the database CreatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item created UpdatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item last updated ClientID string `bun:"type:CHAR(26),nullzero,notnull"` // ID of the client who owns this token UserID string `bun:"type:CHAR(26),nullzero"` // ID of the user who owns this token RedirectURI string `bun:",nullzero,notnull"` // Oauth redirect URI for this token Scope string `bun:",notnull"` // Oauth scope Code string `bun:",pk,nullzero,notnull,default:''"` // Code, if present CodeChallenge string `bun:",nullzero"` // Code challenge, if code present CodeChallengeMethod string `bun:",nullzero"` // Code challenge method, if code present CodeCreateAt time.Time `bun:"type:timestamptz,nullzero"` // Code created time, if code present CodeExpiresAt time.Time `bun:"type:timestamptz,nullzero"` // Code expires at -- null means the code never expires Access string `bun:",pk,nullzero,notnull,default:''"` // User level access token, if present AccessCreateAt time.Time `bun:"type:timestamptz,nullzero"` // User level access token created time, if access present AccessExpiresAt time.Time `bun:"type:timestamptz,nullzero"` // User level access token expires at -- null means the token never expires Refresh string `bun:",pk,nullzero,notnull,default:''"` // Refresh token, if present RefreshCreateAt time.Time `bun:"type:timestamptz,nullzero"` // Refresh created at, if refresh present RefreshExpiresAt time.Time `bun:"type:timestamptz,nullzero"` // Refresh expires at -- null means the refresh token never expires }
Token is a translation of the gotosocial token with the ExpiresIn fields replaced with ExpiresAt.
type Tombstone ¶ added in v0.6.0
type Tombstone struct { ID string `bun:"type:CHAR(26),pk,nullzero,notnull,unique"` // id of this item in the database CreatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item created UpdatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item last updated Domain string `bun:",nullzero,notnull"` // Domain of the Object/Actor. URI string `bun:",nullzero,notnull,unique"` // ActivityPub URI for this Object/Actor. }
Tombstone represents either a remote fediverse account, object, activity etc which has been deleted. It's useful in cases where a remote account has been deleted, and we don't want to keep trying to process subsequent activities from that account, or deletes which target it.
type User ¶
type User struct { ID string `bun:"type:CHAR(26),pk,nullzero,notnull,unique"` // id of this item in the database CreatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item created UpdatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item last updated Email string `bun:",nullzero,unique"` // confirmed email address for this user, this should be unique -- only one email address registered per instance, multiple users per email are not supported AccountID string `bun:"type:CHAR(26),nullzero,notnull,unique"` // The id of the local gtsmodel.Account entry for this user. Account *Account `bun:"rel:belongs-to"` // Pointer to the account of this user that corresponds to AccountID. EncryptedPassword string `bun:",nullzero,notnull"` // The encrypted password of this user, generated using https://pkg.go.dev/golang.org/x/crypto/bcrypt#GenerateFromPassword. A salt is included so we're safe against 🌈 tables. SignUpIP net.IP `bun:",nullzero"` // IP this user used to sign up. Only stored for pending sign-ups. InviteID string `bun:"type:CHAR(26),nullzero"` // id of the user who invited this user (who let this joker in?) Reason string `bun:",nullzero"` // What reason was given for signing up when this user was created? Locale string `bun:",nullzero"` // In what timezone/locale is this user located? CreatedByApplicationID string `bun:"type:CHAR(26),nullzero"` // Which application id created this user? See gtsmodel.Application CreatedByApplication *Application `bun:"rel:belongs-to"` // Pointer to the application corresponding to createdbyapplicationID. LastEmailedAt time.Time `bun:"type:timestamptz,nullzero"` // When was this user last contacted by email. ConfirmationToken string `bun:",nullzero"` // What confirmation token did we send this user/what are we expecting back? ConfirmationSentAt time.Time `bun:"type:timestamptz,nullzero"` // When did we send email confirmation to this user? ConfirmedAt time.Time `bun:"type:timestamptz,nullzero"` // When did the user confirm their email address UnconfirmedEmail string `bun:",nullzero"` // Email address that hasn't yet been confirmed Moderator *bool `bun:",nullzero,notnull,default:false"` // Is this user a moderator? Admin *bool `bun:",nullzero,notnull,default:false"` // Is this user an admin? Disabled *bool `bun:",nullzero,notnull,default:false"` // Is this user disabled from posting? Approved *bool `bun:",nullzero,notnull,default:false"` // Has this user been approved by a moderator? ResetPasswordToken string `bun:",nullzero"` // The generated token that the user can use to reset their password ResetPasswordSentAt time.Time `bun:"type:timestamptz,nullzero"` // When did we email the user their reset-password email? ExternalID string `bun:",nullzero,unique"` // If the login for the user is managed externally (e.g OIDC), we need to keep a stable reference to the external object (e.g OIDC sub claim) }
User represents one signed-up user of this GoToSocial instance.
User may not necessarily be approved yet; in other words, this model is used for both active users and signed-up but not yet approved users.
Sign-ups that have been denied rather than approved are stored as DeniedUser instead.
type UserMute ¶ added in v0.16.0
type UserMute struct { ID string `bun:"type:CHAR(26),pk,nullzero,notnull,unique"` // id of this item in the database CreatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item created UpdatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item last updated ExpiresAt time.Time `bun:"type:timestamptz,nullzero"` // Time mute should expire. If null, should not expire. AccountID string `bun:"type:CHAR(26),unique:user_mutes_account_id_target_account_id_uniq,notnull,nullzero"` // Who does this mute originate from? Account *Account `bun:"-"` // Account corresponding to accountID TargetAccountID string `bun:"type:CHAR(26),unique:user_mutes_account_id_target_account_id_uniq,notnull,nullzero"` // Who is the target of this mute? TargetAccount *Account `bun:"-"` // Account corresponding to targetAccountID Notifications *bool `bun:",nullzero,notnull,default:false"` // Apply mute to notifications as well as statuses. }
UserMute refers to the muting of one account by another.
type Visibility ¶
type Visibility string
Visibility represents the visibility granularity of a status.
const ( // VisibilityNone means nobody can see this. // It's only used for web status visibility. VisibilityNone Visibility = "none" // VisibilityPublic means this status will be visible to everyone on all timelines. VisibilityPublic Visibility = "public" // VisibilityUnlocked means this status will be visible to everyone, but will only show on home timeline to followers, and in lists. VisibilityUnlocked Visibility = "unlocked" // VisibilityFollowersOnly means this status is viewable to followers only. VisibilityFollowersOnly Visibility = "followers_only" // VisibilityMutualsOnly means this status is visible to mutual followers only. VisibilityMutualsOnly Visibility = "mutuals_only" // VisibilityDirect means this status is visible only to mentioned recipients. VisibilityDirect Visibility = "direct" // VisibilityDefault is used when no other setting can be found. VisibilityDefault Visibility = VisibilityUnlocked )
type WorkerTask ¶ added in v0.17.0
type WorkerTask struct { ID uint `bun:",pk,autoincrement"` WorkerType WorkerType `bun:",notnull"` TaskData []byte `bun:",nullzero,notnull"` CreatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` }
WorkerTask represents a queued worker task that was persisted to the database on shutdown. This is only ever used on startup to pickup where we left off, and on shutdown to prevent queued tasks from being lost. It is simply a means to store a blob of serialized task data.
type WorkerType ¶ added in v0.17.0
type WorkerType uint8
const ( DeliveryWorker WorkerType = 1 FederatorWorker WorkerType = 2 ClientWorker WorkerType = 3 )
Source Files ¶
- account.go
- accountnote.go
- accountsettings.go
- accountstats.go
- adminaction.go
- advancedmigration.go
- application.go
- block.go
- client.go
- conversation.go
- domainallow.go
- domainblock.go
- domainpermission.go
- emaildomainblock.go
- emoji.go
- emojicategory.go
- filter.go
- follow.go
- followrequest.go
- headerfilter.go
- instance.go
- interaction.go
- interactionpolicy.go
- list.go
- marker.go
- mediaattachment.go
- mention.go
- move.go
- notification.go
- poll.go
- report.go
- routersession.go
- rule.go
- sinbinstatus.go
- status.go
- statusbookmark.go
- statusfave.go
- statusmute.go
- tag.go
- thread.go
- threadmute.go
- token.go
- tombstone.go
- user.go
- usermute.go
- workertask.go