models

package
v0.0.0-...-5c4db31 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2026 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SettingEnabled  = "enabled"
	SettingPartial  = "partial"
	SettingDisabled = "disabled"
)
View Source
const (
	JobStatusPending = "pending"
	JobStatusBusy    = "busy"
	JobStatusDone    = "done"
	JobStatusFailed  = "failed"
	JobStatusExpired = "expired"
)

Variables

This section is empty.

Functions

func InsertPost

func InsertPost(ctx context.Context, tx bun.Tx, post *Post) error

func SelectPost

func SelectPost(tx bun.IDB, id uuid.UUID, dst *Post) *bun.SelectQuery

func SelectPostWithAllRevisions

func SelectPostWithAllRevisions(tx bun.IDB, id uuid.UUID, dst *Post) *bun.SelectQuery

func SelectPostWithLatestRevision

func SelectPostWithLatestRevision(tx bun.IDB, id uuid.UUID, dst *Post) *bun.SelectQuery

func SelectPostWithRevision

func SelectPostWithRevision(tx bun.IDB, id uuid.UUID, version uint, dst *Post) *bun.SelectQuery

func SelectPosts

func SelectPosts(tx bun.IDB, ids []uuid.UUID, dst []*Post) *bun.SelectQuery

func SelectPostsWithAllRevisions

func SelectPostsWithAllRevisions(tx bun.IDB, ids []uuid.UUID, dst []*Post) *bun.SelectQuery

func SelectPostsWithLatestRevisions

func SelectPostsWithLatestRevisions(tx bun.IDB, ids []uuid.UUID, dst []*Post) *bun.SelectQuery

func UpdatePost

func UpdatePost(ctx context.Context, tx bun.Tx, post *Post) error

func WithAllPostRevisions

func WithAllPostRevisions(q *bun.SelectQuery) *bun.SelectQuery

func WithLatestPostRevision

func WithLatestPostRevision(q *bun.SelectQuery) *bun.SelectQuery

func WithPostRevision

func WithPostRevision(q *bun.SelectQuery, version uint) *bun.SelectQuery

Types

type Account

type Account struct {
	bun.BaseModel `bun:"table:account"`

	ID         uuid.UUID  `bun:"id,pk" json:"id"`
	InstanceID uuid.UUID  `bun:"instance_id" json:"instance_id,omitzero"`
	CreatedAt  time.Time  `bun:"created_at,scanonly" json:"created_at"`
	DeletedAt  *time.Time `bun:"deleted_at" json:"deleted_at,omitempty"`

	Instance *Instance `bun:"rel:belongs-to,join:instance_id=id" json:"instance,omitempty"`

	Authorization *AccountAuthorization `bun:"rel:has-one,join:id=account_id" json:"authorization,omitempty"`
	Configuration *AccountConfiguration `bun:"rel:has-one,join:id=account_id" json:"configuration,omitempty"`

	Profiles []*Profile `bun:"rel:has-many,join:id=account_id" json:"profiles,omitempty"`
}

type AccountAuthorization

type AccountAuthorization struct {
	bun.BaseModel `bun:"table:account_authorization"`

	AccountID    uuid.UUID `bun:"account_id,pk" json:"account_id,omitzero"`
	Username     *string   `bun:"username" json:"username,omitempty"`
	Email        *string   `bun:"email" json:"email,omitempty"`
	PasswordHash string    `bun:"password_hash" json:"-"`
	TOTPKey      *string   `bun:"totp_key" json:"-"`

	Account *Account `bun:"rel:belongs-to,join:account_id=id" json:"account,omitempty"`
}

type AccountBlock

type AccountBlock struct {
	bun.BaseModel `bun:"table:account_block"`

	AccountID uuid.UUID `bun:"account_id,pk" json:"account_id,omitzero"`
	BlockedID uuid.UUID `bun:"blocked_id,pk" json:"blocked_id,omitzero"`
	CreatedAt time.Time `bun:"created_at" json:"created_at"`

	Account *Account `bun:"rel:belongs-to,join:account_id=id" json:"account,omitempty"`
	Blocked *Account `bun:"rel:belongs-to,join:blocked_id=id" json:"blocked,omitempty"`
}

type AccountConfiguration

type AccountConfiguration struct {
	bun.BaseModel `bun:"table:account_configuration"`

	AccountID          uuid.UUID `bun:"account_id" json:"account_id,omitzero"`
	AllowPasswordReset bool      `bun:"allow_password_reset" json:"allow_password_reset"`

	Account *Account `bun:"rel:belongs-to,join:account_id=id" json:"account,omitempty"`
}

type AccountInstanceBlock

type AccountInstanceBlock struct {
	bun.BaseModel `bun:"table:account_instance_block"`

	AccountID uuid.UUID `bun:"account_id" json:"account_id,omitzero"`
	BlockedID uuid.UUID `bun:"field_blocked_id" json:"blocked_id,omitzero"`
	CreatedAt time.Time `bun:"created_at" json:"created_at"`

	Account *Account  `bun:"rel:belongs-to,join:account_id=id" json:"account,omitempty"`
	Blocked *Instance `bun:"rel:belongs-to,join:blocked_id=id" json:"blocked,omitempty"`
}

type AccountSession

type AccountSession struct {
	bun.BaseModel `bun:"table:account_session"`

	ID        uuid.UUID `bun:"id,pk" json:"id"`
	AccountID uuid.UUID `bun:"account_id" json:"account_id,omitzero"`
	CreatedAt time.Time `bun:"created_at,scanonly" json:"created_at"`
	ExpiresAt time.Time `bun:"expires_at" json:"expires_at"`

	Account *Account `bun:"rel:belongs-to,join:account_id=id" json:"account,omitempty"`
}

type AccountWithAuthorization

type AccountWithAuthorization struct {
	bun.BaseModel `bun:"table:account_with_authorization"`

	ID           uuid.UUID `bun:"id" json:"id"`
	InstanceID   uuid.UUID `bun:"instance_id" json:"instance_id,omitzero"`
	Username     *string   `bun:"username" json:"username,omitempty"`
	Email        *string   `bun:"email" json:"email,omitempty"`
	PasswordHash string    `bun:"password_hash" json:"-"`
	TOTPKey      *string   `bun:"totp_key" json:"-"`
	CreatedAt    time.Time `bun:"created_at" json:"created_at"`

	Instance *Instance `bun:"rel:belongs-to,join:instance_id=id" json:"instance,omitempty"`

	Configuration *AccountConfiguration `bun:"rel:has-one,join:id=account_id" json:"configuration,omitempty"`

	Profiles []*Profile `bun:"rel:has-many,join:id=account_id" json:"profiles,omitempty"`
}

func (AccountWithAuthorization) Account

func (account AccountWithAuthorization) Account() Account

func (AccountWithAuthorization) AccountAuthorization

func (account AccountWithAuthorization) AccountAuthorization() AccountAuthorization

type Announcement

type Announcement struct {
	PostID uuid.UUID `bun:"post_id" json:"post_id,omitzero"`

	Post *Post `bun:"rel:belongs-to,join:post_id=id" json:"post,omitempty"`
}

type Color

type Color color.RGBA

func (Color) MarshalJSON

func (c Color) MarshalJSON() ([]byte, error)

func (*Color) Scan

func (c *Color) Scan(value driver.Value) error

func (*Color) UnmarshalJSON

func (c *Color) UnmarshalJSON(raw []byte) error

func (Color) Value

func (c Color) Value() (driver.Value, error)

type CustomEmoji

type CustomEmoji struct {
	bun.BaseModel `bun:"table:custom_emoji"`

	ID        uuid.UUID  `bun:"id" json:"id"`
	Name      string     `bun:"name" json:"name"`
	Unlisted  bool       `bun:"unlisted" json:"unlisted"`
	FileID    uuid.UUID  `bun:"file_id" json:"file_id,omitzero"`
	GroupID   *uuid.UUID `bun:"group_id" json:"group_id,omitempty"`
	CreatedAt time.Time  `bun:"created_at" json:"created_at"`
	DeletedAt *time.Time `bun:"deleted_at" json:"deleted_at,omitempty"`

	File  *File  `bun:"rel:belongs-to,join:file_id=id" json:"file,omitempty"`
	Group *Group `bun:"rel:belongs-to,join:group_id=id" json:"group,omitempty"`
}

type Emoji

type Emoji struct {
	bun.BaseModel `bun:"table:emoji"`

	ID        uuid.UUID  `bun:"id,pk" json:"id"`
	Name      string     `bun:"name" json:"name"`
	Unlisted  bool       `bun:"unlisted" json:"unlisted"`
	FileID    *uuid.UUID `bun:"file_id" json:"file_id,omitempty"`
	GroupID   *uuid.UUID `bun:"group_id" json:"group_id,omitempty"`
	CreatedAt time.Time  `bun:"created_at,scanonly" json:"created_at"`
	DeletedAt *time.Time `bun:"deleted_at" json:"deleted_at,omitempty"`

	File  *File  `bun:"rel:belongs-to,join:file_id=id" json:"file,omitempty"`
	Group *Group `bun:"rel:belongs-to,join:group_id=id" json:"group,omitempty"`
}

type EmojiAlias

type EmojiAlias struct {
	bun.BaseModel `bun:"table:emoji_alias"`

	EmojiID uuid.UUID `bun:"emoji_id" json:"emoji_id,omitzero"`
	Alias   string    `bun:"alias" json:"alias"`

	Emoji *Emoji `bun:"rel:belongs-to,join:emoji_id=id" json:"emoji,omitempty"`
}

type EmojiTag

type EmojiTag struct {
	bun.BaseModel `bun:"table:emoji_tag"`

	EmojiID uuid.UUID `bun:"emoji_id" json:"emoji_id,omitzero"`
	Name    string    `bun:"name" json:"name"`

	Emoji *Emoji `bun:"rel:belongs-to,join:emoji_id=id" json:"emoji,omitempty"`
}

type FederationConfiguration

type FederationConfiguration struct {
	bun.BaseModel `bun:"table:federation_configuration"`

	InstanceID         uuid.UUID `bun:"instance_id" json:"instance_id,omitzero"`
	RestrictFederation bool      `bun:"restrict_federation" json:"restrict_federation"`

	Instance *Instance `bun:"rel:belongs-to,join:instance_id=id" json:"instance,omitempty"`
}

type File

type File struct {
	bun.BaseModel `bun:"table:file"`

	ID        uuid.UUID `bun:"id,pk" json:"id"`
	AccountID uuid.UUID `bun:"account_id" json:"account_id,omitzero"`
	URL       string    `bun:"url" json:"url"`
	MIMEType  string    `bun:"mimetype" json:"mimetype"`
	Size      uint      `bun:"size" json:"size"`
	SHA256    string    `bun:"sha256" json:"sha256"`
	CreatedAt time.Time `bun:"created_at,scanonly" json:"created_at"`

	Account *Account `bun:"rel:belongs-to,join:account_id=id" json:"account,omitempty"`
}

type FileReport

type FileReport struct {
	bun.BaseModel `bun:"table:file_report"`

	ID              uuid.UUID  `bun:"id,pk" json:"id"`
	FileID          uuid.UUID  `bun:"file_id" json:"file_id,omitzero"`
	ReporterID      uuid.UUID  `bun:"reporter_id" json:"reporter_id,omitzero"`
	Content         string     `bun:"content" json:"content"`
	GroupReportID   *uuid.UUID `bun:"group_report_id" json:"group_report_id,omitempty"`
	ProfileReportID *uuid.UUID `bun:"profile_report_id" json:"profile_report_id,omitempty"`
	PostReportID    *uuid.UUID `bun:"post_report_id" json:"post_report_id,omitempty"`
	CreatedAt       time.Time  `bun:"created_at,scanonly" json:"created_at"`

	File     *File    `bun:"rel:belongs-to,join:file_id=id" json:"file,omitempty"`
	Reporter *Profile `bun:"rel:belongs-to,join:reporter_id=id" json:"reporter,omitempty"`

	GroupReport   *GroupReport   `bun:"rel:belongs-to,join:group_report_id=id" json:"group_report,omitempty"`
	ProfileReport *ProfileReport `bun:"rel:belongs-to,join:profile_report_id=id" json:"profile_report,omitempty"`
	PostReport    *PostReport    `bun:"rel:belongs-to,join:post_report_id=id" json:"post_report,omitempty"`
}

type FileRevision

type FileRevision struct {
	bun.BaseModel `bun:"table:file_revision"`

	FileID    uuid.UUID `bun:"file_id,pk" json:"file_id,omitzero"`
	Version   uint      `bun:"version,pk" json:"version"`
	Subject   *string   `bun:"subject" json:"subject,omitempty"`
	AltText   *string   `bun:"alt_text" json:"alt_text,omitempty"`
	CreatedAt time.Time `bun:"created_at" json:"created_at"`

	File *File `bun:"rel:belongs-to,join:file_id=id" json:"file,omitempty"`
}

type Filter

type Filter struct {
	bun.BaseModel `bun:"table:filter"`

	ID        uuid.UUID `bun:"id,pk" json:"id"`
	AccountID uuid.UUID `bun:"account_id" json:"account_id,omitzero"`
	Name      string    `bun:"name" json:"name"`
	CreatedAt time.Time `bun:"created_at,scanonly" json:"created_at"`

	Account *Account `bun:"rel:belongs-to,join:account_id=id" json:"account,omitempty"`
}

type FilterKeyword

type FilterKeyword struct {
	bun.BaseModel `bun:"table:filter_keyword"`

	FilterID uuid.UUID `bun:"filter_id" json:"filter_id,omitzero"`
	Keyword  string    `bun:"keyword" json:"keyword"`
	Regexp   bool      `bun:"regexp" json:"regexp"`

	Filter *Filter `bun:"rel:belongs-to,join:filter_id=id" json:"filter,omitempty"`
}

type Group

type Group struct {
	bun.BaseModel `bun:"table:group"`

	ID               uuid.UUID  `bun:"id,pk" json:"id"`
	InstanceID       uuid.UUID  `bun:"instance_id" json:"instance_id,omitzero"`
	Name             string     `bun:"name" json:"name"`
	DisplayName      string     `bun:"display_name" json:"display_name"`
	Description      string     `bun:"description" json:"description"`
	AvatarFileID     *uuid.UUID `bun:"avatar_file_id" json:"avatar_file_id,omitempty"`
	HeaderFileID     *uuid.UUID `bun:"header_file_id" json:"header_file_id,omitempty"`
	BackgroundFileID *uuid.UUID `bun:"background_file_id" json:"background_file_id,omitempty"`
	AccentColor      *Color     `bun:"accent_color" json:"accent_color,omitempty"`
	Private          bool       `bun:"private" json:"private"`
	CreatedAt        time.Time  `bun:"created_at,scanonly" json:"created_at"`

	Instance       *Instance `bun:"rel:belongs-to,join:instance_id=id" json:"instance,omitempty"`
	AvatarFile     *File     `bun:"rel:belongs-to,join:avatar_file_id=id" json:"avatar_file,omitempty"`
	HeaderFile     *File     `bun:"rel:belongs-to,join:header_file_id=id" json:"header_file,omitempty"`
	BackgroundFile *File     `bun:"rel:belongs-to,join:background_file_id=id" json:"background_file,omitempty"`

	Admins   []*GroupAdmin         `bun:"rel:has-many,join:id=group_id" json:"admins,omitempty"`
	Members  []*GroupMember        `bun:"rel:has-many,join:id=group_id" json:"members,omitempty"`
	Bans     []*GroupBan           `bun:"rel:has-many,join:id=group_id" json:"bans,omitempty"`
	Invites  []*GroupMemberInvite  `bun:"rel:has-many,join:id=group_id" json:"invites,omitempty"`
	Requests []*GroupMemberRequest `bun:"rel:has-many,join:id=group_id" json:"requests,omitempty"`
}

type GroupAdmin

type GroupAdmin struct {
	bun.BaseModel `bun:"table:group_admin"`

	GroupID   uuid.UUID `bun:"group_id" json:"group_id,omitzero"`
	ProfileID uuid.UUID `bun:"profile_id" json:"profile_id,omitzero"`
	Owner     bool      `bun:"owner" json:"owner"`
	CreatedAt time.Time `bun:"created_at" json:"created_at"`

	Group   *Group   `bun:"rel:belongs-to,join:group_id=id" json:"group,omitempty"`
	Profile *Profile `bun:"rel:belongs-to,join:profile_id=id" json:"profile,omitempty"`
}

type GroupBan

type GroupBan struct {
	bun.BaseModel `bun:"table:group_ban"`

	GroupID   uuid.UUID  `bun:"group_id" json:"group_id,omitzero"`
	BannedID  uuid.UUID  `bun:"banned_id" json:"banned_id,omitzero"`
	AdminID   *uuid.UUID `bun:"admin_id" json:"admin_id,omitempty"`
	Reason    string     `bun:"reason" json:"reason"`
	CreatedAt time.Time  `bun:"created_at" json:"created_at"`

	Group  *Group   `bun:"rel:belongs-to,join:group_id=id" json:"group,omitempty"`
	Banned *Account `bun:"rel:belongs-to,join:banned_id=id" json:"banned,omitempty"`
	Admin  *Profile `bun:"rel:belongs-to,join:admin_id=id" json:"admin,omitempty"`
}

type GroupConfiguration

type GroupConfiguration struct {
	bun.BaseModel `bun:"table:group_configuration"`

	GroupID       uuid.UUID `bun:"group_id" json:"group_id,omitzero"`
	ShowMembers   string    `bun:"show_members,nullzero,type:setting_ternary" json:"show_members"`
	AutoAccept    bool      `bun:"auto_accept" json:"auto_accept"`
	AllowRequests bool      `bun:"allow_requests" json:"allow_requests"`
	AllowInvites  bool      `bun:"allow_invites" json:"allow_invites"`

	Group *Group `bun:"rel:belongs-to,join:group_id=id" json:"group,omitempty"`
}

type GroupMember

type GroupMember struct {
	bun.BaseModel `bun:"table:group_member"`

	GroupID   uuid.UUID `bun:"group_id" json:"group_id,omitzero"`
	MemberID  uuid.UUID `bun:"member_id" json:"member_id,omitzero"`
	CreatedAt time.Time `bun:"created_at" json:"created_at"`

	Group  *Group   `bun:"rel:belongs-to,join:group_id=id" json:"group,omitempty"`
	Member *Profile `bun:"rel:belongs-to,join:profile_id=id" json:"member,omitempty"`

	Invites []*GroupMemberInvite `bun:"rel:has-many,join:group_id=group_id,join:member_id=member_id" json:"invites,omitempty"`
}

type GroupMemberInvite

type GroupMemberInvite struct {
	bun.BaseModel `bun:"table:group_member_invite"`

	GroupID   uuid.UUID `bun:"group_id" json:"group_id,omitzero"`
	MemberID  uuid.UUID `bun:"member_id" json:"member_id,omitzero"`
	ProfileID uuid.UUID `bun:"profile_id" json:"profile_id,omitzero"`
	CreatedAt time.Time `bun:"created_at" json:"created_at"`

	Group   *Group   `bun:"rel:belongs-to,join:group_id=id" json:"group,omitempty"`
	Member  *Profile `bun:"rel:belongs-to,join:member_id=id" json:"member,omitempty"`
	Profile *Profile `bun:"rel:belongs-to,join:profile_id=id" json:"profile,omitempty"`
}

type GroupMemberRequest

type GroupMemberRequest struct {
	bun.BaseModel `bun:"table:group_member_request"`

	GroupID   uuid.UUID `bun:"group_id" json:"group_id,omitzero"`
	ProfileID uuid.UUID `bun:"profile_id" json:"profile_id,omitzero"`
	CreatedAt time.Time `bun:"created_at" json:"created_at"`

	Group   *Group   `bun:"rel:belongs-to,join:group_id=id" json:"group,omitempty"`
	Profile *Profile `bun:"rel:belongs-to,join:profile_id=id" json:"profile,omitempty"`
}

type GroupReport

type GroupReport struct {
	bun.BaseModel `bun:"table:group_report"`

	ID         uuid.UUID `bun:"id,pk" json:"id"`
	GroupID    uuid.UUID `bun:"group_id" json:"group_id,omitzero"`
	ReporterID uuid.UUID `bun:"reporter_id" json:"reporter_id,omitzero"`
	Content    string    `bun:"content" json:"content"`
	CreatedAt  time.Time `bun:"created_at,scanonly" json:"created_at"`

	Group    *Group   `bun:"rel:belongs-to,join:group_id=id" json:"group,omitempty"`
	Reporter *Profile `bun:"rel:belongs-to,join:reporter_id=id" json:"reporter,omitempty"`
}

type Instance

type Instance struct {
	bun.BaseModel `bun:"table:instance"`

	ID        uuid.UUID  `bun:"id,pk" json:"id"`
	Host      string     `bun:"host" json:"host"`
	Remote    bool       `bun:"remote" json:"remote"`
	CreatedAt time.Time  `bun:"created_at,scanonly" json:"created_at"`
	DeletedAt *time.Time `bun:"deleted_at" json:"deleted_at,omitempty"`

	Profile                   *InstanceProfile           `bun:"rel:has-one,join:id=instance_id" json:"profile,omitempty"`
	FederationConfiguration   *FederationConfiguration   `bun:"rel:has-one,join:id=instance_id" json:"federation_configuration,omitempty"`
	LimitsConfiguration       *LimitsConfiguration       `bun:"rel:has-one,join:id=instance_id" json:"limits_configuration,omitempty"`
	RegistrationConfiguration *RegistrationConfiguration `bun:"rel:has-one,join:id=instance_id" json:"registration_configuration,omitempty"`

	Admins   []*Account `bun:"m2m:instance_admin,join:Instance=Account" json:"-"`
	Accounts []*Account `bun:"rel:has-many,join:id=instance_id" json:"-"`
}

type InstanceAdmin

type InstanceAdmin struct {
	bun.BaseModel `bun:"table:instance_admin"`

	InstanceID uuid.UUID `bun:"instance_id" json:"instance_id,omitzero"`
	AccountID  uuid.UUID `bun:"account_id" json:"account_id,omitzero"`

	Instance *Instance `bun:"rel:belongs-to,join:instance_id=id" json:"instance,omitempty"`
	Account  *Account  `bun:"rel:belongs-to,join:account_id=id" json:"account,omitempty"`
}

type InstanceBlock

type InstanceBlock struct {
	bun.BaseModel `bun:"table:instance_block"`

	InstanceID   uuid.UUID `bun:"instance_id,pk" json:"instance_id,omitzero"`
	RejectMedia  bool      `bun:"reject_media" json:"reject_media"`
	RejectEvents bool      `bun:"reject_events" json:"reject_events"`
	CreatedAt    time.Time `bun:"created_at" json:"created_at"`

	Instance *Instance `bun:"rel:belongs-to,join:instance_id=id" json:"instance,omitempty"`
}

type InstanceProfile

type InstanceProfile struct {
	bun.BaseModel `bun:"table:instance_profile"`

	InstanceID  uuid.UUID `bun:"instance_id" json:"instance_id,omitzero"`
	DisplayName string    `bun:"display_name" json:"display_name"`
	Description string    `bun:"description" json:"description"`

	Instance *Instance `bun:"rel:belongs-to,join:instance_id=id" json:"instance,omitempty"`
}

type InstanceReport

type InstanceReport struct {
	bun.BaseModel `bun:"table:instance_report"`

	ID         uuid.UUID `bun:"id,pk" json:"id"`
	InstanceID uuid.UUID `bun:"instance_id" json:"instance_id,omitzero"`
	ReporterID uuid.UUID `bun:"reporter_id" json:"reporter_id,omitzero"`
	Content    string    `bun:"content" json:"content"`
	CreatedAt  time.Time `bun:"created_at,scanonly" json:"created_at"`

	Instance *Instance `bun:"rel:belongs-to,join:instance_id=id" json:"instance,omitempty"`
	Reporter *Profile  `bun:"rel:belongs-to,join:reporter_id=id" json:"reporter,omitempty"`
}

type Job

type Job struct {
	bun.BaseModel `bun:"table:job"`

	ID         uuid.UUID       `bun:"id,pk" json:"id"`
	Type       string          `bun:"type" json:"type"`
	Status     JobStatus       `bun:"status" json:"status"`
	Detail     json.RawMessage `bun:"detail,type:jsonb" json:"detail"`
	ScheduleID *uuid.UUID      `bun:"schedule_id" json:"schedule_id,omitempty"`
	CreatedAt  time.Time       `bun:"created_at,scanonly" json:"created_at"`
	UpdatedAt  time.Time       `bun:"updated_at,nullzero" json:"updated_at"`
	ExpiresAt  *time.Time      `bun:"expires_at,nullzero" json:"expires_at"`

	Schedule *JobSchedule `bun:"rel:belongs-to,join:schedule_id=id" json:"schedule,omitempty"`
}

type JobSchedule

type JobSchedule struct {
	bun.BaseModel `bun:"table:job_schedule"`

	ID       uuid.UUID       `bun:"id,pk" json:"id"`
	Type     string          `bun:"type" json:"type"`
	Schedule string          `bun:"schedule" json:"schedule"`
	Detail   json.RawMessage `bun:"detail,type:jsonb" json:"detail"`
	Once     bool            `bun:"once" json:"once"`

	Jobs []*Job `bun:"rel:has-many,join:id=schedule_id" json:"scheduler,omitempty"`
}

type JobStatus

type JobStatus string

func (JobStatus) Valid

func (status JobStatus) Valid() bool

type LimitsConfiguration

type LimitsConfiguration struct {
	bun.BaseModel `bun:"table:limits_configuration"`

	InstanceID uuid.UUID `bun:"instance_id"`

	AccountProfilesLimit uint `bun:"account_profiles_limit"`

	ProfileNameCharacterLimit        uint `bun:"profile_name_character_limit"`
	ProfileDisplayNameCharacterLimit uint `bun:"profile_display_name_character_limit"`
	ProfileDescriptionCharacterLimit uint `bun:"profile_description_character_limit"`
	ProfileTimelinesLimit            uint `bun:"profile_timelines_limit"`

	GroupNameCharacterLimit        uint `bun:"group_name_character_limit"`
	GroupDisplayNameCharacterLimit uint `bun:"group_display_name_character_limit"`
	GroupDescriptionCharacterLimit uint `bun:"group_description_character_limit"`

	PostCharacterLimit   uint `bun:"post_character_limit"`
	PostAttachmentsLimit uint `bun:"post_attachments_limit"`
	PostPollsLimit       uint `bun:"post_polls_limit"`

	PollOptionsLimit         uint `bun:"poll_options_limit"`
	PollOptionCharacterLimit uint `bun:"poll_option_character_limit"`

	FilterKeywordsLimit         uint `bun:"filter_keywords_limit"`
	FilterKeywordCharacterLimit uint `bun:"filter_keyword_character_limit"`

	Instance *Instance `bun:"rel:belongs-to,join:instance_id=id" json:"instance,omitempty"`
}

type Poll

type Poll struct {
	bun.BaseModel `bun:"table:poll"`

	ID                 uuid.UUID  `bun:"id,pk" json:"id"`
	ProfileID          uuid.UUID  `bun:"profile_id" json:"profile_id,omitzero"`
	MaximumVoteCount   *uint      `bun:"allow_multiple_votes" json:"maximum_vote_count,omitempty"`
	AllowCustomOptions bool       `bun:"allow_custom_options" json:"allow_custom_options"`
	CreatedAt          time.Time  `bun:"created_at,scanonly" json:"created_at"`
	ExpiresAt          *time.Time `bun:"expires_at" json:"expires_at,omitempty"`

	Profile *Profile `bun:"rel:belongs-to,join:profile_id=id" json:"profile,omitempty"`

	Options []*PollOption `bun:"rel:has-many,join:id=poll_id" json:"options,omitempty"`

	Votes []*PollVote `bun:"m2m:poll_option,join:Poll=Option" json:"votes,omitempty"`
}

type PollOption

type PollOption struct {
	bun.BaseModel `bun:"table:poll_option"`

	ID        uuid.UUID `bun:"id,pk" json:"id"`
	PollID    uuid.UUID `bun:"poll_id" json:"poll_id,omitzero"`
	Order     uint      `bun:"order" fieldopt:"withquote" json:"order"`
	CreatedAt time.Time `bun:"created_at,scanonly" json:"created_at"`

	Poll *Poll `bun:"rel:belongs-to,join:poll_id=id" json:"poll,omitempty"`
}

type PollOptionRevision

type PollOptionRevision struct {
	bun.BaseModel `bun:"table:poll_option_revision"`

	OptionID  uuid.UUID `bun:"option_id,pk" json:"option_id,omitzero"`
	Version   uint      `bun:"version,pk" json:"version"`
	Content   string    `bun:"content" json:"content"`
	CreatedAt time.Time `bun:"created_at" json:"created_at"`

	Option *PollOption `bun:"rel:belongs-to,join:option_id=id" json:"option,omitempty"`
}

type PollVote

type PollVote struct {
	bun.BaseModel `bun:"table:poll_vote"`

	ProfileID     uuid.UUID `bun:"profile_id" json:"profile_id,omitzero"`
	OptionID      uuid.UUID `bun:"option_id" json:"option_id,omitzero"`
	OptionVersion uint      `bun:"option_version" json:"option_version"`
	CreatedAt     time.Time `bun:"created_at" json:"created_at"`

	Profile        *Profile            `bun:"rel:belongs-to,join:profile_id=id" json:"profile,omitempty"`
	Option         *PollOption         `bun:"rel:belongs-to,join:option_id=id" json:"option,omitempty"`
	OptionRevision *PollOptionRevision `bun:"rel:belongs-to,join:option_id=id,join:option_version=version" json:"option_revision,omitempty"`
}

type Post

type Post struct {
	bun.BaseModel `bun:"table:post"`

	ID        uuid.UUID  `bun:"id,pk" json:"id"`
	ProfileID uuid.UUID  `bun:"profile_id" json:"profile_id,omitzero"`
	ReplyToID *uuid.UUID `bun:"reply_to_id" json:"reply_to_id,omitempty"`
	CreatedAt time.Time  `bun:"created_at,scanonly" json:"created_at"`
	DeletedAt *time.Time `bun:"deleted_at" json:"deleted_at,omitempty"`

	Profile *Profile `bun:"rel:belongs-to,join:profile_id=id" json:"profile,omitempty"`
	ReplyTo *Post    `bun:"rel:belongs-to,join:reply_to_id=id" json:"reply_to,omitempty"`

	Replies []*Post `bun:"rel:has-many,join:id=reply_to_id" json:"replies,omitempty"`

	PostAttachments []*PostAttachment `bun:"rel:has-many,join:id=post_id" json:"post_attachments,omitempty"`
	PostFavorites   []*PostFavorite   `bun:"rel:has-many,join:id=post_id" json:"post_favorites,omitempty"`
	PostGroups      []*PostGroup      `bun:"rel:has-many,join:id=post_id" json:"post_groups,omitempty"`
	PostPolls       []*PostPoll       `bun:"rel:has-many,join:id=post_id" json:"post_polls,omitempty"`
	PostReactions   []*PostReaction   `bun:"rel:has-many,join:id=post_id" json:"post_reactions,omitempty"`
	PostRevisions   []*PostRevision   `bun:"rel:has-many,join:id=post_id" json:"post_revisions,omitempty"`
	PostTags        []*PostTag        `bun:"rel:has-many,join:id=post_id" json:"post_tags,omitempty"`

	Groups []*Group `bun:"m2m:post_group,join:Post=Group" json:"groups,omitempty"`
	Files  []*File  `bun:"m2m:post_attachment,join:Post=File" json:"files,omitempty"`
	Polls  []*Poll  `bun:"m2m:post_poll,join:Post=Poll" json:"polls,omitempty"`
}

func MakePost

func MakePost(id, profileID uuid.UUID, replyToID *uuid.UUID, subject *string, content string, fileIDs, groupIDs []uuid.UUID, tags []string) Post

type PostAttachment

type PostAttachment struct {
	bun.BaseModel `bun:"table:post_attachment"`

	PostID uuid.UUID `bun:"post_id,pk" json:"post_id,omitzero"`
	Order  uint      `bun:"order,pk" fieldopt:"withquote" json:"order"`
	FileID uuid.UUID `bun:"file_id" json:"file_id,omitzero"`

	Post *Post `bun:"rel:belongs-to,join:post_id=id" json:"post,omitempty"`
	File *File `bun:"rel:belongs-to,join:file_id=id" json:"file,omitempty"`
}

type PostFavorite

type PostFavorite struct {
	bun.BaseModel `bun:"table:post_favorite"`

	PostID    uuid.UUID `bun:"post_id,pk" json:"post_id,omitzero"`
	ProfileID uuid.UUID `bun:"profile_id,pk" json:"profile_id,omitzero"`

	Post    *Post    `bun:"rel:belongs-to,join:post_id=id" json:"post,omitempty"`
	Profile *Profile `bun:"rel:belongs-to,join:profile_id=id" json:"profile,omitempty"`
}

type PostGroup

type PostGroup struct {
	bun.BaseModel `bun:"table:post_group"`

	PostID  uuid.UUID `bun:"post_id,pk" json:"post_id,omitzero"`
	GroupID uuid.UUID `bun:"group_id,pk" json:"group_id,omitzero"`

	Post  *Post  `bun:"rel:belongs-to,join:post_id=id" json:"post,omitempty"`
	Group *Group `bun:"rel:belongs-to,join:group_id=id" json:"group,omitempty"`
}

type PostPoll

type PostPoll struct {
	bun.BaseModel `bun:"table:post_poll"`

	PostID uuid.UUID `bun:"post_id,pk" json:"post_id,omitzero"`
	PollID uuid.UUID `bun:"poll_id,pk" json:"poll_id,omitzero"`

	Post *Post `bun:"rel:belongs-to,join:post_id=id" json:"post,omitempty"`
	Poll *Poll `bun:"rel:belongs-to,join:poll_id=id" json:"poll,omitempty"`
}

type PostReaction

type PostReaction struct {
	bun.BaseModel `bun:"table:post_reaction"`

	PostID    uuid.UUID `bun:"post_id,pk" json:"post_id,omitzero"`
	ProfileID uuid.UUID `bun:"profile_id,pk" json:"profile_id,omitzero"`
	EmojiID   uuid.UUID `bun:"emoji_id" json:"emoji_id,omitzero"`

	Post    *Post    `bun:"rel:belongs-to,join:post_id=id" json:"post,omitempty"`
	Profile *Profile `bun:"rel:belongs-to,join:profile_id=id" json:"profile,omitempty"`
	Emoji   *Emoji   `bun:"rel:belongs-to,join:emoji_id=id" json:"emoji,omitempty"`
}

type PostReport

type PostReport struct {
	bun.BaseModel `bun:"table:post_report"`

	ID              uuid.UUID  `bun:"id,pk" json:"id"`
	PostID          uuid.UUID  `bun:"post_id" json:"post_id"`
	PostVersion     uint       `bun:"post_version" json:"post_version"`
	ReporterID      uuid.UUID  `bun:"reporter_id" json:"reporter_id,omitzero"`
	GroupReportID   *uuid.UUID `bun:"group_report_id" json:"group_report_id,omitempty"`
	ProfileReportID *uuid.UUID `bun:"profile_report_id" json:"profile_report_id,omitempty"`
	Content         string     `bun:"content" json:"content"`
	CreatedAt       time.Time  `bun:"created_at,scanonly" json:"created_at"`

	Post     *Post         `bun:"rel:belongs-to,join:post_id=id" json:"post,omitempty"`
	Revision *PostRevision `bun:"rel:belongs-to,join:post_id=id,join:post_version=version"`

	Reporter      *Profile       `bun:"rel:belongs-to,join:reporter_id=id" json:"reporter,omitempty"`
	GroupReport   *GroupReport   `bun:"rel:belongs-to,join:group_report_id=id" json:"group_report,omitempty"`
	ProfileReport *ProfileReport `bun:"rel:belongs-to,join:profile_report_id=id" json:"profile_report,omitempty"`
}

type PostRevision

type PostRevision struct {
	bun.BaseModel `bun:"table:post_revision"`

	PostID    uuid.UUID `bun:"post_id" json:"post_id,omitzero"`
	Version   uint      `bun:"version" json:"version"`
	Subject   *string   `bun:"subject" json:"subject,omitempty"`
	Content   string    `bun:"content" json:"content"`
	CreatedAt time.Time `bun:"created_at" json:"created_at"`

	Post *Post `bun:"rel:belongs-to,join:post_id=id" json:"post,omitempty"`
}

type PostTag

type PostTag struct {
	bun.BaseModel `bun:"table:post_tag"`

	PostID uuid.UUID `bun:"post_id" json:"post_id,omitzero"`
	Tag    string    `bun:"tag" json:"tag"`
	Order  uint      `bun:"order" fieldopt:"withquote" json:"order"`

	Post *Post `bun:"rel:belongs-to,join:post_id=id" json:"post,omitempty"`
}

type Profile

type Profile struct {
	bun.BaseModel `bun:"table:profile"`

	ID        uuid.UUID  `bun:"id,pk" json:"id"`
	AccountID uuid.UUID  `bun:"account_id" json:"account_id,omitzero"`
	CreatedAt time.Time  `bun:"created_at,scanonly" json:"created_at"`
	DeletedAt *time.Time `bun:"deleted_at" json:"deleted_at,omitempty"`

	Account *Account `bun:"rel:belongs-to,join:account_id=id" json:"account,omitempty"`

	Biography     *ProfileBiography     `bun:"rel:has-one,join:id=profile_id" json:"biography,omitempty"`
	Configuration *ProfileConfiguration `bun:"rel:has-one,join:id=profile_id" json:"configuration,omitempty"`
}

type ProfileBiography

type ProfileBiography struct {
	bun.BaseModel `bun:"table:profile_biography"`

	ProfileID        uuid.UUID  `bun:"profile_id,pk" json:"profile_id,omitzero"`
	Name             string     `bun:"name" json:"name,omitempty"`
	DisplayName      string     `bun:"display_name" json:"display_name,omitempty"`
	Description      string     `bun:"description" json:"description,omitempty"`
	AvatarFileID     *uuid.UUID `bun:"avatar_file_id" json:"avatar_file_id,omitempty"`
	HeaderFileID     *uuid.UUID `bun:"header_file_id" json:"header_file_id,omitempty"`
	BackgroundFileID *uuid.UUID `bun:"background_file_id" json:"background_file_id,omitempty"`
	AccentColor      *Color     `bun:"accent_color" json:"accent_color,omitempty"`

	Profile        *Profile `bun:"rel:belongs-to,join:profile_id=id" json:"profile,omitempty"`
	AvatarFile     *File    `bun:"rel:belongs-to,join:avatar_file_id=id" json:"avatar_file,omitempty"`
	HeaderFile     *File    `bun:"rel:belongs-to,join:header_file_id=id" json:"header_file,omitempty"`
	BackgroundFile *File    `bun:"rel:belongs-to,join:background_file_id=id" json:"background_file,omitempty"`
}

type ProfileConfiguration

type ProfileConfiguration struct {
	bun.BaseModel `bun:"table:profile_configuration"`

	ProfileID          uuid.UUID `bun:"profile_id" json:"profile_id,omitzero"`
	ConnectionRequests string    `bun:"connection_requests,nullzero,type:setting_ternary" json:"connection_requests"`
	ShowConnections    string    `bun:"show_connections,nullzero,type:setting_ternary" json:"show_connections"`
	SharePostHistory   bool      `bun:"share_post_history" json:"share_post_history"`

	Profile *Profile `bun:"rel:belongs-to,join:profile_id=id" json:"profile,omitempty"`
}

type ProfileConnection

type ProfileConnection struct {
	bun.BaseModel `bun:"table:profile_connection"`

	Profile1ID uuid.UUID `bun:"profile1_id" json:"profile1_id"`
	Profile2ID uuid.UUID `bun:"profile2_id" json:"profile2_id"`
	CreatedAt  time.Time `bun:"created_at" json:"created_at"`

	Profile1 *Profile `bun:"rel:belongs-to,join:profile1_id=id" json:"profile1"`
	Profile2 *Profile `bun:"rel:belongs-to,join:profile2_id=id" json:"profile2"`
}

type ProfileConnectionRequest

type ProfileConnectionRequest struct {
	bun.BaseModel `bun:"table:profile_connection_request"`

	ProfileID   uuid.UUID `bun:"profile_id" json:"profile_id,omitzero"`
	RequesterID uuid.UUID `bun:"requester_id" json:"requester_id,omitzero"`
	CreatedAt   time.Time `bun:"created_at" json:"created_at"`

	Profile   *Profile `bun:"rel:belongs-to,join:profile_id=id" json:"profile,omitempty"`
	Requester *Profile `bun:"rel:belongs-to,join:requester_id=id" json:"requester,omitempty"`
}

type ProfileField

type ProfileField struct {
	bun.BaseModel `bun:"table:profile_field"`

	ProfileID uuid.UUID `bun:"profile_id" json:"profile_id,omitzero"`
	Key       string    `bun:"key" json:"key"`
	Value     string    `bun:"value" json:"value"`
	Order     uint      `bun:"order" fieldopt:"withquote" json:"order"`

	Profile *Profile `bun:"rel:belongs-to,join:profile_id=id" json:"profile,omitempty"`
}

type ProfileFilter

type ProfileFilter struct {
	bun.BaseModel `bun:"table:profile_filter"`

	ProfileID uuid.UUID `bun:"profile_id" json:"profile_id,omitzero"`
	FilterID  uuid.UUID `bun:"filter_id" json:"filter_id,omitzero"`
	Enable    bool      `bun:"enable" json:"enable"`

	Profile *Profile `bun:"rel:belongs-to,join:profile_id=id" json:"profile,omitempty"`
	Filter  *Filter  `bun:"rel:belongs-to,join:filter_id=id" json:"filter,omitempty"`
}

type ProfileGroupConfiguration

type ProfileGroupConfiguration struct {
	bun.BaseModel `bun:"table:profile_group_configuration"`

	ProfileID          uuid.UUID `bun:"profile_id" json:"profile_id,omitzero"`
	GroupID            uuid.UUID `bun:"group_id" json:"group_id,omitzero"`
	ConnectionRequests string    `bun:"connection_requests,nullzero,type:setting_ternary" json:"connection_requests"`
	ShowConnections    string    `bun:"show_connections,nullzero,type:setting_ternary" json:"show_connections"`
	SharePostHistory   bool      `bun:"share_post_history" json:"share_post_history"`

	Profile *Profile `bun:"rel:belongs-to,join:profile_id=id" json:"profile,omitempty"`
	Group   *Group   `bun:"rel:belongs-to,join:group_id=id" json:"group,omitempty"`
}

type ProfileInstanceMute

type ProfileInstanceMute struct {
	bun.BaseModel `bun:"table:profile_instance_mute"`

	ProfileID uuid.UUID  `bun:"profile_id" json:"profile_id,omitzero"`
	MutedID   uuid.UUID  `bun:"muted_id" json:"muted_id,omitzero"`
	CreatedAt time.Time  `bun:"created_at" json:"created_at"`
	DeleteAt  *time.Time `bun:"delete_at" json:"delete_at,omitempty"`

	Profile *Profile  `bun:"rel:belongs-to,join:profile_id=id" json:"profile,omitempty"`
	Muted   *Instance `bun:"rel:belongs-to,join:muted_id=id" json:"muted,omitempty"`
}

type ProfileMute

type ProfileMute struct {
	bun.BaseModel `bun:"table:profile_mute"`

	ProfileID uuid.UUID  `bun:"profile_id" json:"profile_id,omitzero"`
	MutedID   uuid.UUID  `bun:"muted_id" json:"muted_id,omitzero"`
	CreatedAt time.Time  `bun:"created_at" json:"created_at"`
	DeleteAt  *time.Time `bun:"delete_at" json:"delete_at,omitempty"`

	Profile *Profile `bun:"rel:belongs-to,join:profile_id=id" json:"profile,omitempty"`
	Muted   *Profile `bun:"rel:belongs-to,join:muted_id=id" json:"muted,omitempty"`
}

type ProfileReport

type ProfileReport struct {
	bun.BaseModel `bun:"table:profile_report"`

	ID         uuid.UUID `bun:"id,pk" json:"id"`
	ProfileID  uuid.UUID `bun:"profile_id" json:"profile_id,omitzero"`
	ReporterID uuid.UUID `bun:"reporter_id" json:"reporter_id,omitzero"`
	Content    string    `bun:"content" json:"content"`
	CreatedAt  time.Time `bun:"created_at,scanonly" json:"created_at"`

	Profile  *Profile `bun:"rel:belongs-to,join:profile_id=id" json:"profile,omitempty"`
	Reporter *Profile `bun:"rel:belongs-to,join:reporter_id=id" json:"reporter,omitempty"`
}

type RegistrationConfiguration

type RegistrationConfiguration struct {
	bun.BaseModel `bun:"table:registration_configuration"`

	InstanceID        uuid.UUID `bun:"instance_id" json:"instance_id,omitzero"`
	AllowRegistration string    `bun:"allow_registration,nullzero,type:setting_ternary" json:"allow_registration"`

	Instance *Instance `bun:"rel:belongs-to,join:instance_id=id" json:"instance,omitempty"`
}

type Timeline

type Timeline struct {
	bun.BaseModel `bun:"table:timeline"`

	ID        uuid.UUID `bun:"id,pk" json:"id"`
	ProfileID uuid.UUID `bun:"profile_id" json:"profile_id,omitzero"`
	Name      string    `bun:"name" json:"name"`
	Order     uint      `bun:"order" fieldopt:"withquote" json:"order"`
	CreatedAt time.Time `bun:"created_at,scanonly" json:"created_at"`

	Profile *Profile `bun:"rel:belongs-to,join:profile_id=id" json:"profile,omitempty"`

	Configuration *TimelineConfiguration `bun:"rel:has-one,join:id=timeline_id" json:"configuration,omitempty"`

	Filters  []*TimelineFilter  `bun:"m2m:timeline_filter,join:Timeline=Filter" json:"filters,omitempty"`
	Groups   []*TimelineGroup   `bun:"m2m:timeline_group,join:Timeline=Group" json:"groups,omitempty"`
	Profiles []*TimelineProfile `bun:"m2m:timeline_profile,join:Timeline=Profile" json:"profiles,omitempty"`
}

type TimelineConfiguration

type TimelineConfiguration struct {
	bun.BaseModel `bun:"table:timeline_configuration"`

	TimelineID      uuid.UUID `bun:"timeline_id" json:"timeline_id,omitzero"`
	AutoAddProfiles bool      `bun:"auto_add_profiles" json:"auto_add_profiles"`
	AutoAddGroups   bool      `bun:"auto_add_groups" json:"auto_add_groups"`

	Timeline *Timeline `bun:"rel:belongs-to,join:timeline_id=id" json:"timeline,omitempty"`
}

type TimelineFilter

type TimelineFilter struct {
	bun.BaseModel `bun:"table:timeline_filter"`

	TimelineID uuid.UUID `bun:"timeline_id" json:"timeline_id,omitzero"`
	FilterID   uuid.UUID `bun:"filter_id" json:"filter_id,omitzero"`
	Enable     bool      `bun:"enable" json:"enable"`

	Timeline *Timeline `bun:"rel:belongs-to,join:timeline_id=id" json:"timeline,omitempty"`
	Filter   *Filter   `bun:"rel:belongs-to,join:filter_id=id" json:"filter,omitempty"`
}

type TimelineGroup

type TimelineGroup struct {
	bun.BaseModel `bun:"table:timeline_group"`

	TimelineID uuid.UUID `bun:"timeline_id" json:"timeline_id,omitzero"`
	GroupID    uuid.UUID `bun:"group_id" json:"group_id,omitzero"`

	Timeline *Timeline `bun:"rel:belongs-to,join:timeline_id=id" json:"timeline,omitempty"`
	Group    *Group    `bun:"rel:belongs-to,join:group_id=id" json:"group,omitempty"`
}

type TimelinePost

type TimelinePost struct {
	bun.BaseModel `bun:"table:timeline_post"`

	TimelineID uuid.UUID `bun:"timeline_id" json:"timeline_id,omitzero"`
	PostID     uuid.UUID `bun:"post_id" json:"post_id,omitzero"`

	Timeline *Timeline `bun:"rel:belongs-to,join:timeline_id=id" json:"timeline,omitempty"`
	Post     *Post     `bun:"rel:belongs-to,join:post_id=id" json:"post,omitempty"`
}

type TimelineProfile

type TimelineProfile struct {
	bun.BaseModel `bun:"table:timeline_profile"`

	TimelineID uuid.UUID `bun:"timeline_id" json:"timeline_id,omitzero"`
	ProfileID  uuid.UUID `bun:"profile_id" json:"profile_id,omitzero"`

	Timeline *Timeline `bun:"rel:belongs-to,join:timeline_id=id" json:"timeline,omitempty"`
	Profile  *Profile  `bun:"rel:belongs-to,join:profile_id=id" json:"profile,omitempty"`
}

Jump to

Keyboard shortcuts

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