Documentation ¶
Overview ¶
package models contains the database models for the m. Urgh, a package called models, I know, I know.
Index ¶
- func AllTables() []interface{}
- func MaybeExcludeReblogs(r *http.Request) func(db *gorm.DB) *gorm.DB
- func MaybeExcludeReplies(r *http.Request) func(db *gorm.DB) *gorm.DB
- func MaybePinned(r *http.Request) func(db *gorm.DB) *gorm.DB
- func PaginateActors(r *http.Request) func(db *gorm.DB) *gorm.DB
- func PaginateConversation(r *http.Request) func(db *gorm.DB) *gorm.DB
- func PaginateRelationship(r *http.Request) func(db *gorm.DB) *gorm.DB
- func PaginateStatuses(r *http.Request) func(db *gorm.DB) *gorm.DB
- func PreloadAccount(query *gorm.DB) *gorm.DB
- func PreloadActor(query *gorm.DB) *gorm.DB
- func PreloadReaction(actor *Actor) func(query *gorm.DB) *gorm.DB
- func PreloadRelationshipTarget(db *gorm.DB) *gorm.DB
- func PreloadStatus(query *gorm.DB) *gorm.DB
- type Account
- type AccountList
- type AccountListMember
- type AccountMarker
- type AccountPreferences
- type AccountRole
- type Accounts
- type ActivitypubOutboxRequest
- type ActivitypubRefresh
- type Actor
- func (a *Actor) Acct() string
- func (a *Actor) ActorType() string
- func (a *Actor) AfterCreate(tx *gorm.DB) error
- func (a *Actor) AfterSave(tx *gorm.DB) error
- func (a *Actor) Attributes() []ActorAttachment
- func (a *Actor) Avatar() string
- func (a *Actor) DisplayName() string
- func (a *Actor) Header() string
- func (a *Actor) Inbox() string
- func (a *Actor) InboxURL() string
- func (a *Actor) IsBot() bool
- func (a *Actor) IsGroup() bool
- func (a *Actor) IsLocal() bool
- func (a *Actor) IsPerson() bool
- func (a *Actor) IsRemote() bool
- func (a *Actor) Locked() bool
- func (a *Actor) Note() string
- func (a *Actor) OutboxURL() string
- func (a *Actor) PublicKey() []byte
- func (a *Actor) PublicKeyID() string
- func (a *Actor) SharedInboxURL() string
- func (a *Actor) URI() string
- func (a *Actor) URL() string
- type ActorAttachment
- type ActorObject
- type ActorRefreshRequest
- type ActorType
- type Actors
- type Application
- type Attachment
- type AttachmentFocalPoint
- type Conversation
- type Env
- type FocalPoint
- type Instance
- type InstanceRule
- type Instances
- type Object
- type Peer
- type PushSubscription
- type PushSubscriptionPolicy
- type Reaction
- type ReactionRequest
- type ReactionRequestAction
- type Reactions
- func (r *Reactions) Bookmark(status *Status, actor *Actor) (*Reaction, error)
- func (r *Reactions) Favourite(status *Status, actor *Actor) (*Reaction, error)
- func (r *Reactions) Pin(status *Status, actor *Actor) (*Reaction, error)
- func (r *Reactions) Reblog(status *Status, actor *Actor) (*Status, error)
- func (r *Reactions) Unbookmark(status *Status, actor *Actor) (*Reaction, error)
- func (r *Reactions) Unfavourite(status *Status, actor *Actor) (*Reaction, error)
- func (r *Reactions) Unpin(status *Status, actor *Actor) (*Reaction, error)
- func (r *Reactions) Unreblog(status *Status, actor *Actor) (*Status, error)
- type Relationship
- type RelationshipRequest
- type RelationshipRequestAction
- type Relationships
- func (r *Relationships) Block(actor, target *Actor) (*Relationship, error)
- func (r *Relationships) Follow(actor, target *Actor) (*Relationship, error)
- func (r *Relationships) Mute(actor, target *Actor) (*Relationship, error)
- func (r *Relationships) Unblock(actor, target *Actor) (*Relationship, error)
- func (r *Relationships) Unfollow(actor, target *Actor) (*Relationship, error)
- func (r *Relationships) Unmute(actor, target *Actor) (*Relationship, error)
- type Request
- type Status
- func (st *Status) AfterCreate(tx *gorm.DB) error
- func (st *Status) AfterUpdate(tx *gorm.DB) error
- func (st *Status) Attachments() []*Attachment
- func (st *Status) Language() string
- func (st *Status) Note() string
- func (st *Status) Sensitive() bool
- func (st *Status) SpoilerText() string
- func (st *Status) Tag() []StatusTag
- func (st *Status) URI() string
- type StatusAttachment
- type StatusAttachmentRequest
- type StatusMention
- type StatusObject
- type StatusPoll
- type StatusPollOption
- type StatusTag
- type StatusTags
- type Statuses
- func (s *Statuses) Create(actor *Actor, parent *Status, visibility Visibility, sensitive bool, ...) (*Status, error)
- func (s *Statuses) FindByID(id snowflake.ID) (*Status, error)
- func (s *Statuses) FindByURI(uri string) (*Status, error)
- func (s *Statuses) FindOrCreateByURI(uri string) (*Status, error)
- type Tag
- type Token
- type TokenType
- type Visibility
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AllTables ¶
func AllTables() []interface{}
AllTables returns a slice of all tables in the database.
func MaybeExcludeReblogs ¶
MaybeExcludeReblogs returns a query that excludes reblogs if the request contains the exclude_reblogs parameter.
func MaybeExcludeReplies ¶
MaybeExcludeReplies returns a query that excludes replies if the request contains the exclude_replies parameter.
func MaybePinned ¶
MaybePinned returns a query that only includes pinned statuses if the request contains the pinned parameter.
func PreloadAccount ¶
PreloadAccount preloads all of an Account's relations and associations.
func PreloadActor ¶
PreloadActor preloads all of an Actor's relations and associations.
func PreloadReaction ¶
PreloadReaction preloads all of a Reaction's relations and associations.
Types ¶
type Account ¶
type Account struct { snowflake.ID `gorm:"primarykey;autoIncrement:false"` UpdatedAt time.Time InstanceID snowflake.ID Instance *Instance `gorm:"<-:create;"` ActorID snowflake.ID Actor *Actor `gorm:"<-:create;"` Lists []AccountList `gorm:"constraint:OnDelete:CASCADE;"` Markers []AccountMarker `gorm:"constraint:OnDelete:CASCADE;"` Email string `gorm:"size:64;not null"` EncryptedPassword []byte `gorm:"size:60;not null"` PrivateKey []byte `gorm:"not null"` RoleID uint32 Role *AccountRole }
An Account is a user account on an Instance. An Account belongs to an Actor. An Account belongs to an Instance.
func (*Account) PublicKeyID ¶
type AccountList ¶
type AccountList struct { snowflake.ID `gorm:"primarykey;autoIncrement:false"` AccountID snowflake.ID `gorm:"not null;"` Title string `gorm:"size:64"` RepliesPolicy string `gorm:"enum('public','followers','none');not null;default:'public'"` Members []AccountListMember `gorm:"constraint:OnDelete:CASCADE;"` }
type AccountListMember ¶
type AccountMarker ¶
type AccountMarker struct { ID uint32 `gorm:"primarykey"` CreatedAt time.Time UpdatedAt time.Time AccountID snowflake.ID `gorm:"not null;uniqueIndex:idx_account_name;index"` Name string `gorm:"enum('home','notifications');not null;uniqueIndex:idx_account_name"` Version int32 `gorm:"not null;"` LastReadID snowflake.ID `gorm:"not null;"` }
type AccountPreferences ¶
type AccountPreferences struct { AccountID snowflake.ID `gorm:"primarykey;autoIncrement:false"` PostingDefaultVisibility string `gorm:"enum('public', 'unlisted', 'private', 'direct');not null;default:'public'"` PostingDefaultSensitive bool `gorm:"not null;default:false"` PostingDefaultLanguage string `gorm:"size:8;"` ReadingExpandMedia string `gorm:"enum('default','show_all','hide_all');not null;default:'default'"` ReadingExpandSpoilers bool `gorm:"not null;default:false"` }
type AccountRole ¶
type Accounts ¶
type Accounts struct {
// contains filtered or unexported fields
}
func NewAccounts ¶
func (*Accounts) AccountForActor ¶
type ActivitypubOutboxRequest ¶
type ActivitypubOutboxRequest struct { Request // StatusID is the ID of the status to send. StatusID snowflake.ID `gorm:"not null"` Status *Status `gorm:"constraint:OnDelete:CASCADE;<-:false;"` // ActorID is the ID of the remote actor to send the status to. ActorID snowflake.ID `gorm:"not null"` Actor *Actor `gorm:"constraint:OnDelete:CASCADE;<-:false;"` }
ActivitypubOutboxRequest is a record of a request to send a status to an actor on a remote server.
type ActivitypubRefresh ¶
type ActivitypubRefresh struct { Request // URI is the URI to refresh. URI string `gorm:"size:255;not null;uniqueIndex"` // DependsOn is the URI that this URI depends on. // For example if URI is a reply, DependsOn is the URI of the status being replied to. // If URI is a status, DependsOn is the URI of the actor. DependsOn string `gorm:"size:255"` }
ActivitypubRefresh is a record of a request to refresh a URI.
type Actor ¶
type Actor struct { ObjectID snowflake.ID `gorm:"primarykey;autoIncrement:false"` Object *ActorObject `gorm:"constraint:OnDelete:CASCADE;<-:false"` UpdatedAt time.Time `gorm:"autoUpdateTime:false"` Type ActorType `gorm:"default:'Person';not null"` Name string `gorm:"size:64;uniqueIndex:idx_actor_name_domain;not null"` Domain string `gorm:"size:64;uniqueIndex:idx_actor_name_domain;not null"` FollowersCount int32 `gorm:"default:0;not null"` FollowingCount int32 `gorm:"default:0;not null"` StatusesCount int32 `gorm:"default:0;not null"` LastStatusAt time.Time }
func (*Actor) Attributes ¶
func (a *Actor) Attributes() []ActorAttachment
func (*Actor) DisplayName ¶
func (*Actor) PublicKeyID ¶
func (*Actor) SharedInboxURL ¶
type ActorAttachment ¶
type ActorObject ¶
type ActorObject struct { ID snowflake.ID Type string URI string Properties struct { Type string `json:"type"` // The Actor's unique global identifier. ID string `json:"id"` Inbox string `json:"inbox"` Outbox string `json:"outbox"` PreferredUsername string `json:"preferredUsername"` Name string `json:"name"` Summary string `json:"summary"` Icon struct { Type string `json:"type"` MediaType string `json:"mediaType"` URL string `json:"url"` } `json:"icon"` Image struct { Type string `json:"type"` MediaType string `json:"mediaType"` URL string `json:"url"` } `json:"image"` Endpoints struct { SharedInbox string `json:"sharedInbox"` } `json:"endpoints"` ManuallyApprovesFollowers bool `json:"manuallyApprovesFollowers"` PublicKey struct { ID string `json:"id"` Owner string `json:"owner"` PublicKeyPem string `json:"publicKeyPem"` } `json:"publicKey"` Attachments []ActorAttachment `json:"attachment"` } `gorm:"serializer:json;not null"` }
func (ActorObject) TableName ¶
func (ActorObject) TableName() string
type ActorRefreshRequest ¶
type ActorRefreshRequest struct { Request // ActorID is the ID of the actor to refresh. ActorID snowflake.ID `gorm:"uniqueIndex;not null;"` // Actor is the actor to refresh. Actor *Actor `gorm:"constraint:OnDelete:CASCADE;<-:false;"` }
ActorRefreshRequest is a request to refresh an actor's data.
type Actors ¶
type Actors struct {
// contains filtered or unexported fields
}
type Application ¶
type Application struct { snowflake.ID `gorm:"primarykey;autoIncrement:false"` InstanceID snowflake.ID Instance *Instance `gorm:"constraint:OnDelete:CASCADE;<-:false;"` Name string `gorm:"size:255;not null"` Website string `gorm:"size:255"` RedirectURI string `gorm:"size:255;not null"` ClientID string `gorm:"size:255;not null"` ClientSecret string `gorm:"size:255;not null"` VapidKey string `gorm:"size:255;not null"` Scopes string `gorm:"size:255;not null;default:''"` }
An Application is a registered client application. An Application belongs to an Instance.
type Attachment ¶
type Attachment struct { // snowflake.ID `gorm:"primarykey;autoIncrement:false"` MediaType string `gorm:"size:64;not null"` URL string `gorm:"size:255;not null"` Name string `gorm:"not null"` Blurhash string `gorm:"size:36;not null"` Width int `gorm:"not null"` Height int `gorm:"not null"` FocalPoint FocalPoint `gorm:"embedded;embeddedPrefix:focal_point_"` }
func (*Attachment) Extension ¶
func (att *Attachment) Extension() string
Extension returns the file extension of the attachment. This is used to generate the filename of the attachment which most IOS clients expect.
func (*Attachment) ToType ¶
func (att *Attachment) ToType() string
ToType returns the Mastodon type of the attachment, image, video, audio or unknown.
type AttachmentFocalPoint ¶
type AttachmentFocalPoint []float64
func (*AttachmentFocalPoint) UnmarshalJSON ¶
func (fp *AttachmentFocalPoint) UnmarshalJSON(b []byte) error
type Conversation ¶
type Conversation struct { ID uint32 `gorm:"primarykey"` CreatedAt time.Time UpdatedAt time.Time Visibility Visibility `gorm:"not null;check <> ''"` }
A Conversation is a collection of related statuses. It is a way to group together statuses that are replies to each other, or that are part of the same thread of conversation. Conversations are not necessarily public, and may be limited to a set of participants.
type FocalPoint ¶
type Instance ¶
type Instance struct { snowflake.ID `gorm:"primarykey;autoIncrement:false"` UpdatedAt time.Time Domain string `gorm:"size:64;uniqueIndex"` AdminID *snowflake.ID Admin *Account `gorm:"foreignKey:AdminID;constraint:OnDelete:CASCADE;<-:create;"` // the admin account for this instance SourceURL string Title string `gorm:"size:64"` ShortDescription string Description string Thumbnail string `gorm:"size:64"` AccountsCount int `gorm:"default:0;not null"` StatusesCount int `gorm:"default:0;not null"` DomainsCount int32 `gorm:"default:0;not null"` Rules []InstanceRule `gorm:"constraint:OnDelete:CASCADE;"` }
An Instance is an ActivityPub domain managed by this server. An Instance has many InstanceRules. An Instance has one Admin Account.
type InstanceRule ¶
type Instances ¶
type Instances struct {
// contains filtered or unexported fields
}
func NewInstances ¶
type Object ¶
type Object struct { ID snowflake.ID `gorm:"primarykey;autoIncrement:false"` Type string `gorm:"type:varchar(16);not null"` URI string `gorm:"type:varchar(255);not null;uniqueIndex"` Properties map[string]any `gorm:"serializer:json;not null"` }
Object represents an ActivityPub object.
type PushSubscription ¶
type PushSubscription struct { ID uint32 `gorm:"primaryKey"` AccountID snowflake.ID Account *Account `gorm:"constraint:OnDelete:CASCADE;<-:false;"` Endpoint string `gorm:"not null"` Mention bool Status bool Reblog bool Follow bool FollowRequest bool Favourite bool Poll bool Update bool Policy PushSubscriptionPolicy `gorm:"not null;default:'all'"` }
type PushSubscriptionPolicy ¶
type PushSubscriptionPolicy string
func (PushSubscriptionPolicy) GormDBDataType ¶
type Reaction ¶
type Reaction struct { StatusID snowflake.ID `gorm:"primarykey;autoIncrement:false"` Status *Status `gorm:"constraint:OnDelete:CASCADE;<-:false"` ActorID snowflake.ID `gorm:"primarykey;autoIncrement:false"` Actor *Actor `gorm:"constraint:OnDelete:CASCADE;<-:false"` Favourited bool `gorm:"not null;default:false"` Reblogged bool `gorm:"not null;default:false"` Muted bool `gorm:"not null;default:false"` Bookmarked bool `gorm:"not null;default:false"` Pinned bool `gorm:"not null;default:false"` }
Reaction represents an an actors reaction to a status.
type ReactionRequest ¶
type ReactionRequest struct { Request // ActorID is the ID of the actor that is requesting the reaction change. ActorID snowflake.ID `gorm:"uniqueIndex:uidx_reaction_requests_actor_id_target_id;not null;"` // Actor is the actor that is requesting the reaction change. Actor *Actor `gorm:"constraint:OnDelete:CASCADE;<-:false"` TargetID snowflake.ID `gorm:"uniqueIndex:uidx_reaction_requests_actor_id_target_id;not null;"` // Target is the status that is being reacted to. Target *Status `gorm:"constraint:OnDelete:CASCADE;<-:false"` // Action is the action to perform, either follow or unfollow. Action ReactionRequestAction `gorm:"not null"` }
A ReactionRequest is a request to update the reaction to a status. ReactionRequests are created by hooks on the Reaction model, and are processed by the ReactionRequestProcessor in the background.
type ReactionRequestAction ¶
type ReactionRequestAction string
func (ReactionRequestAction) GormDBDataType ¶
type Reactions ¶
type Reactions struct {
// contains filtered or unexported fields
}
func NewReactions ¶
func (*Reactions) Unbookmark ¶
func (*Reactions) Unfavourite ¶
type Relationship ¶
type Relationship struct { ActorID snowflake.ID `gorm:"primarykey;autoIncrement:false"` Actor *Actor `gorm:"constraint:OnDelete:CASCADE;<-:false;"` TargetID snowflake.ID `gorm:"primarykey;autoIncrement:false"` Target *Actor `gorm:"foreignKey:TargetID;constraint:OnDelete:CASCADE;<-:false;"` Muting bool `gorm:"not null;default:false"` Blocking bool `gorm:"not null;default:false"` BlockedBy bool `gorm:"not null;default:false"` Following bool `gorm:"not null;default:false"` FollowedBy bool `gorm:"not null;default:false"` Note string `gorm:"type:text"` }
func (*Relationship) AfterUpdate ¶
func (r *Relationship) AfterUpdate(tx *gorm.DB) error
AfterUpdate updates the followers and following counts for the actor and target.
func (*Relationship) BeforeUpdate ¶
func (r *Relationship) BeforeUpdate(tx *gorm.DB) error
BeforeUpdate creates a relationship request between the actor and target.
type RelationshipRequest ¶
type RelationshipRequest struct { Request // ActorID is the ID of the actor that is requesting the relationship change. ActorID snowflake.ID `gorm:"uniqueIndex:uidx_relationship_requests_actor_id_target_id;not null;"` // Actor is the actor that is requesting the relationship change. Actor *Actor `gorm:"constraint:OnDelete:CASCADE;<-:false;"` TargetID snowflake.ID `gorm:"uniqueIndex:uidx_relationship_requests_actor_id_target_id;not null;"` // Target is the actor that is being followed or unfollowed. Target *Actor `gorm:"constraint:OnDelete:CASCADE;<-:false;"` // Action is the action to perform, either follow or unfollow. Action RelationshipRequestAction `gorm:"not null"` }
A RelationshipRequest records a request to follow or unfollow an actor. RelationshipRequests are created by hooks on the Relationship model, and are processed by the RelationshipRequestProcessor in the background.
type RelationshipRequestAction ¶
type RelationshipRequestAction string
func (RelationshipRequestAction) GormDBDataType ¶
type Relationships ¶
type Relationships struct {
// contains filtered or unexported fields
}
func NewRelationships ¶
func NewRelationships(db *gorm.DB) *Relationships
func (*Relationships) Block ¶
func (r *Relationships) Block(actor, target *Actor) (*Relationship, error)
Block blocks the target from the actor.
func (*Relationships) Follow ¶
func (r *Relationships) Follow(actor, target *Actor) (*Relationship, error)
Follow establishes a follow relationship between actor and the target.
func (*Relationships) Mute ¶
func (r *Relationships) Mute(actor, target *Actor) (*Relationship, error)
Mute mutes the target from the actor.
func (*Relationships) Unblock ¶
func (r *Relationships) Unblock(actor, target *Actor) (*Relationship, error)
Unblock removes a block relationship between actor and the target.
func (*Relationships) Unfollow ¶
func (r *Relationships) Unfollow(actor, target *Actor) (*Relationship, error)
Unfollow removes a follow relationship between actor and the target.
func (*Relationships) Unmute ¶
func (r *Relationships) Unmute(actor, target *Actor) (*Relationship, error)
Unmute removes a mute relationship between actor and the target.
type Request ¶
type Request struct { ID uint32 `gorm:"primarykey;"` // CreatedAt is the time the request was created. CreatedAt time.Time // UpdatedAt is the time the request was last updated. UpdatedAt time.Time // Attempts is the number of times the request has been attempted. Attempts uint32 `gorm:"not null;default:0"` // LastAttempt is the time the request was last attempted. LastAttempt time.Time // LastResult is the result of the last attempt if it failed. LastResult string `gorm:"type:text;"` }
type Status ¶
type Status struct { ObjectID snowflake.ID `gorm:"primarykey;autoIncrement:false"` Object *StatusObject `gorm:"constraint:OnDelete:CASCADE;<-:false"` UpdatedAt time.Time `gorm:"autoUpdateTime:false"` ActorID snowflake.ID Actor *Actor `gorm:"constraint:OnDelete:CASCADE;<-:false;"` // don't update actor on status update ConversationID uint32 Conversation *Conversation `gorm:"constraint:OnDelete:CASCADE;"` InReplyToID *snowflake.ID InReplyTo *Status `gorm:"constraint:OnDelete:SET NULL;<-:false;"` // don't update in_reply_to on status update InReplyToActorID *snowflake.ID Visibility Visibility `gorm:"not null"` RepliesCount int `gorm:"not null;default:0"` ReblogsCount int `gorm:"not null;default:0"` FavouritesCount int `gorm:"not null;default:0"` ReblogID *snowflake.ID Reblog *Status `gorm:"foreignKey:ReblogID;constraint:OnDelete:CASCADE;<-:false;"` // don't update reblog on status update Reaction *Reaction `gorm:"constraint:OnDelete:CASCADE;<-:false;"` // don't update reaction on status update }
A Status is a single message posted by a user. It may be a reply to another status, or a new thread of conversation. A Status belongs to a single Account, and is part of a single Conversation.
func (*Status) Attachments ¶
func (st *Status) Attachments() []*Attachment
func (*Status) SpoilerText ¶
type StatusAttachment ¶
type StatusAttachmentRequest ¶
type StatusAttachmentRequest struct { ID uint32 `gorm:"primarykey;"` // CreatedAt is the time the request was created. CreatedAt time.Time // UpdatedAt is the time the request was last updated. UpdatedAt time.Time // StatusAttachmentID is the ID of the StatusAttachment that the request is for. StatusAttachmentID snowflake.ID `gorm:"uniqueIndex;not null;"` // StatusAttachment is the StatusAttachment that the request is for. StatusAttachment *StatusAttachment `gorm:"constraint:OnDelete:CASCADE;<-:false;"` // Attempts is the number of times the request has been attempted. Attempts uint32 `gorm:"not null;default:0"` // LastAttempt is the time the request was last attempted. LastAttempt time.Time // LastResult is the result of the last attempt if it failed. LastResult string `gorm:"size:255;not null;default:''"` }
A StatusAttachmentRequest records a request fetch a remote attachment. StatusAttachmentRequest are created by hooks on the StatusAttachment model, and are processed by the StatusAttachmentRequestProcessor in the background.
type StatusMention ¶
type StatusObject ¶
type StatusObject struct { ID snowflake.ID Type string URI string Properties struct { Type string `json:"type"` // The Actor's unique global identifier. ID string `json:"id"` Content string `json:"content"` Sensitive bool `json:"sensitive"` // as:sensitive Summary string `json:"summary"` Attachment []StatusAttachment `json:"attachment"` Tag StatusTags `json:"tag"` } `gorm:"serializer:json;not null"` }
func (StatusObject) TableName ¶
func (StatusObject) TableName() string
type StatusPoll ¶
type StatusPoll struct { StatusID snowflake.ID `gorm:"primarykey;autoIncrement:false"` ExpiresAt time.Time Multiple bool VotesCount int `gorm:"not null;default:0"` Options []StatusPollOption `gorm:"constraint:OnDelete:CASCADE;"` }
func (*StatusPoll) AfterCreate ¶
func (st *StatusPoll) AfterCreate(tx *gorm.DB) error
type StatusPollOption ¶
type StatusTags ¶
type StatusTags []StatusTag
func (*StatusTags) UnmarshalJSON ¶
func (st *StatusTags) UnmarshalJSON(b []byte) error
type Statuses ¶
type Statuses struct {
// contains filtered or unexported fields
}
func NewStatuses ¶
type Token ¶
type Token struct { AccessToken string `gorm:"size:64;primaryKey;autoIncrement:false"` CreatedAt time.Time AccountID *snowflake.ID Account *Account `gorm:"constraint:OnDelete:CASCADE;<-:false;"` ApplicationID snowflake.ID Application *Application `gorm:"constraint:OnDelete:CASCADE;<-:false;"` TokenType `gorm:"not null"` Scope string `gorm:"size:64;not null"` AuthorizationCode string `gorm:"size:64;not null"` }
A Token is an access token for an Application. A Token belongs to an Account. A Token belongs to an Application.