gtsmodel

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2024 License: AGPL-3.0 Imports: 11 Imported by: 0

README

A note on when we should set data structures linked to objects in the database to use the bun nullzero tag -- this should only be done if the member type is a pointer, or if the this primitive type is literally invalid with an empty value (e.g. media IDs which when empty signifies a null database value, compared to say an account note which when empty could mean either an empty note OR null database value).

Obviously it is a little more complex than this in practice, but keep it in mind!

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

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

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., “[email protected]“. 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
	SharedInboxURI          *string          `bun:""`                                                            // Address of this account's ActivityPub sharedInbox. Gotcha warning: this is a string pointer because it has three possible states: 1. We don't know yet if the account has a shared inbox -- null. 2. We know it doesn't have a shared inbox -- empty string. 3. We know it does have a shared inbox -- url string.
	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.
}

Account represents either a local or a remote fediverse account, gotosocial or otherwise (mastodon, pleroma, etc).

func (*Account) AlsoKnownAsPopulated added in v0.14.0

func (a *Account) AlsoKnownAsPopulated() bool

AlsoKnownAsPopulated returns whether alsoKnownAs accounts are populated according to current AlsoKnownAsURIs.

func (*Account) EmojisPopulated added in v0.8.0

func (a *Account) EmojisPopulated() bool

EmojisPopulated returns whether emojis are populated according to current EmojiIDs.

func (*Account) IsAliasedTo added in v0.15.0

func (a *Account) IsAliasedTo(uri string) bool

IsAliasedTo returns true if account is aliased to the given account URI.

func (*Account) IsInstance added in v0.7.0

func (a *Account) IsInstance() bool

IsInstance returns whether account is an instance internal actor account.

func (*Account) IsLocal added in v0.7.0

func (a *Account) IsLocal() bool

IsLocal returns whether account is a local user account.

func (*Account) IsMoving added in v0.15.0

func (a *Account) IsMoving() bool

IsMoving returns true if account is Moving or has Moved.

func (*Account) IsNew added in v0.13.3

func (a *Account) IsNew() bool

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

func (a *Account) IsRemote() bool

IsRemote returns whether account is a remote user account.

func (*Account) IsSuspended added in v0.15.0

func (a *Account) IsSuspended() bool

IsSuspended returns true if account has been suspended from this instance.

func (*Account) PubKeyExpired added in v0.12.0

func (a *Account) PubKeyExpired() bool

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.
	Reason            string     `bun:",nullzero"`                                                   // What reason was given for signing up when this account was created?
	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.
}

AccountSettings models settings / preferences for a local, non-instance 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 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

type Content struct {
	Content    string
	ContentMap map[string]string
}

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 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:",nullzero,notnull"`                                           // Path of the emoji image in the server storage system.
	ImageStaticPath        string         `bun:",nullzero,notnull"`                                           // Path of a static version of the emoji image in the server storage system
	ImageContentType       string         `bun:",nullzero,notnull"`                                           // MIME content type of the emoji image
	ImageStaticContentType string         `bun:",nullzero,notnull"`                                           // MIME content type of the static version of the emoji image.
	ImageFileSize          int            `bun:",nullzero,notnull"`                                           // Size of the emoji image file in bytes, for serving purposes.
	ImageStaticFileSize    int            `bun:",nullzero,notnull"`                                           // Size of the static version of the emoji image file in bytes, for serving purposes.
	ImageUpdatedAt         time.Time      `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // When was the emoji image last updated?
	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"`
}

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

func (e *Emoji) IsLocal() bool

IsLocal returns true if the emoji is local to this instance., ie., it did not originate from a remote instance.

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:",nullzero,notnull"`                                           // Path of the file in storage.
	ContentType string    `bun:",nullzero,notnull"`                                           // MIME content type of the file.
	FileSize    int       `bun:",notnull"`                                                    // File size in bytes
	UpdatedAt   time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // When was the file last updated.
}

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 string

FileType refers to the file type of the media attaachment.

const (
	FileTypeImage   FileType = "Image"   // FileTypeImage is for jpegs, pngs, and standard gifs
	FileTypeGifv    FileType = "Gifv"    // FileTypeGif is for soundless looping videos that behave like gifs
	FileTypeAudio   FileType = "Audio"   // FileTypeAudio is for audio-only files (no video)
	FileTypeVideo   FileType = "Video"   // FileTypeVideo is for files with audio + visual
	FileTypeUnknown FileType = "Unknown" // FileTypeUnknown is for unknown file types (surprise surprise!)
)

MediaAttachment file types.

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"`                              // ID of the local account that created the filter.
	Title                string           `bun:",nullzero,notnull,unique"`                                    // 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 (
	// 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?
}

FilterKeyword stores a single keyword to filter statuses against.

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

type Focus struct {
	X float32
	Y float32
}

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 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 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
	ListEntries   []*ListEntry  `bun:"-"`                                                           // Entries contained by this list.
	RepliesPolicy RepliesPolicy `bun:",nullzero,notnull,default:'followed'"`                        // RepliesPolicy for this list.
}

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:",nullzero,notnull"`                                           // Type of file (image/gifv/audio/video/unknown)
	FileMeta          FileMeta         `bun:",embed:,nullzero,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.

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:
	// @[email protected]
	//
	// 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.
	Email    string // Email address of the user.
	Password string // Plaintext (not yet hashed) password for the user.

	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.

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.
)

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 "@[email protected]" 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 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

func (p *Poll) Closed() bool

Closed returns whether the Poll is closed (i.e. date is set and BEFORE now).

func (*Poll) DecrementVotes added in v0.13.0

func (p *Poll) DecrementVotes(choices []int)

DecrementVotes decrements Poll vote and voter counts for given choices.

func (*Poll) Expired added in v0.13.0

func (p *Poll) Expired() bool

Expired returns whether the Poll is expired (i.e. date is BEFORE now).

func (*Poll) GetChoice added in v0.13.0

func (p *Poll) GetChoice(name string) int

GetChoice returns the option index with name.

func (*Poll) IncrementVotes added in v0.13.0

func (p *Poll) IncrementVotes(choices []int)

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 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)
	Boostable                *bool              `bun:",notnull"`                                                    // This status can be boosted/reblogged
	Replyable                *bool              `bun:",notnull"`                                                    // This status can be replied to
	Likeable                 *bool              `bun:",notnull"`                                                    // This status can be liked/faved
}

Status represents a user-created 'post' or 'status' in the database, either remote or local

func (*Status) AttachmentsPopulated added in v0.8.0

func (s *Status) AttachmentsPopulated() bool

AttachmentsPopulated returns whether media attachments are populated according to current AttachmentIDs.

func (*Status) BelongsToAccount added in v0.13.0

func (s *Status) BelongsToAccount(accountID string) bool

BelongsToAccount returns whether status belongs to the given account ID.

func (*Status) EmojisPopulated added in v0.8.0

func (s *Status) EmojisPopulated() bool

EmojisPopulated returns whether emojis are populated according to current EmojiIDs.

func (*Status) EmojisUpToDate added in v0.9.0

func (s *Status) EmojisUpToDate(other *Status) bool

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

func (s *Status) GetAccountID() string

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

func (s *Status) GetBoostOfAccountID() string

GetBoostOfAccountID implements timeline.Timelineable{}.

func (*Status) GetBoostOfID added in v0.2.0

func (s *Status) GetBoostOfID() string

GetBoostID implements timeline.Timelineable{}.

func (*Status) GetID added in v0.2.0

func (s *Status) GetID() string

GetID implements timeline.Timelineable{}.

func (*Status) GetMentionByTargetURI added in v0.9.0

func (s *Status) GetMentionByTargetURI(uri string) (*Mention, bool)

GetMentionByTargetURI searches status for Mention{} with target URI.

func (*Status) GetTagByName added in v0.13.0

func (s *Status) GetTagByName(name string) (*Tag, bool)

GetTagByName searches status for Tag{} with name.

func (*Status) IsLocal added in v0.14.0

func (s *Status) IsLocal() bool

IsLocal returns true if this is a local status (ie., originating from this instance).

func (*Status) MentionsAccount added in v0.8.0

func (s *Status) MentionsAccount(accountID string) bool

MentionsAccount returns whether status mentions the given account ID.

func (*Status) MentionsPopulated added in v0.8.0

func (s *Status) MentionsPopulated() bool

MentionsPopulated returns whether mentions are populated according to current MentionIDs.

func (*Status) TagsPopulated added in v0.8.0

func (s *Status) TagsPopulated() bool

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
}

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:",nullzero,notnull"`                                           // Path of the file in storage.
	ContentType string    `bun:",nullzero,notnull"`                                           // MIME content type of the file.
	FileSize    int       `bun:",notnull"`                                                    // File size in bytes
	UpdatedAt   time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // When was the file last updated.
	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.golang.ir/golang.org/x/crypto/bcrypt#GenerateFromPassword. A salt is included so we're safe against 🌈 tables.
	SignUpIP               net.IP       `bun:",nullzero"`                                                   // From what IP was this user created?
	CurrentSignInAt        time.Time    `bun:"type:timestamptz,nullzero"`                                   // When did the user sign in with their current session.
	CurrentSignInIP        net.IP       `bun:",nullzero"`                                                   // What's the most recent IP of this user
	LastSignInAt           time.Time    `bun:"type:timestamptz,nullzero"`                                   // When did this user last sign in?
	LastSignInIP           net.IP       `bun:",nullzero"`                                                   // What's the previous IP of this user?
	SignInCount            int          `bun:",notnull,default:0"`                                          // How many times has this user signed in?
	InviteID               string       `bun:"type:CHAR(26),nullzero"`                                      // id of the user who invited this user (who let this joker in?)
	ChosenLanguages        []string     `bun:",nullzero"`                                                   // What languages does this user want to see?
	FilteredLanguages      []string     `bun:",nullzero"`                                                   // What languages does this user not want to see?
	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 an actual human user of gotosocial. Note, this is a LOCAL gotosocial user, not a remote account. To cross reference this local user with their account (which can be local or remote), use the AccountID field.

type Visibility

type Visibility string

Visibility represents the visibility granularity of a status.

const (
	// 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
)

Jump to

Keyboard shortcuts

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