models

package
v0.0.0-...-e647751 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2022 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApplicationToken

type ApplicationToken struct {
	ID          int64        `validate:"-" bun:"id,pk,autoincrement"`
	CreatedAt   time.Time    `validate:"-" bun:",nullzero,notnull,default:current_timestamp"`
	UpdatedAt   time.Time    `validate:"-" bun:",nullzero,notnull,default:current_timestamp"`
	Token       string       `validate:"-" bun:",nullzero,notnull"`
	Description string       `validate:"-" bun:",nullzero,notnull"`
	CreatedByID int64        `validate:"-" bun:",nullzero,notnull"`
	CreatedBy   *FediAccount `validate:"-" bun:"rel:belongs-to"`
}

ApplicationToken contains application authentication tokens.

func (*ApplicationToken) BeforeAppendModel

func (f *ApplicationToken) BeforeAppendModel(_ context.Context, query bun.Query) error

BeforeAppendModel runs before a bun append operation.

type FediAccount

type FediAccount struct {
	ID          int64         `validate:"-" bun:"id,pk,autoincrement"`
	CreatedAt   time.Time     `validate:"-" bun:",nullzero,notnull,default:current_timestamp"`
	UpdatedAt   time.Time     `validate:"-" bun:",nullzero,notnull,default:current_timestamp"`
	ActorURI    string        `validate:"url" bun:",nullzero,notnull"`
	Username    string        `validate:"-" bun:",unique:unique_fedi_user,nullzero,notnull"`
	InstanceID  int64         `validate:"-" bun:",unique:unique_fedi_user,nullzero,notnull"`
	Instance    *FediInstance `validate:"-" bun:"rel:belongs-to,join:instance_id=id"`
	DisplayName string        `validate:"-" bun:",notnull"`
	LastFinger  time.Time     `validate:"-" bun:",notnull"`
	LogInCount  int64         `validate:"-" bun:",nullzero,notnull,default:0"`
	LogInLast   time.Time     `validate:"-" bun:",nullzero"`
	AccessToken []byte        `validate:"-" bun:",nullzero"`

	// login stuff
	Admin bool `validate:"-" bun:",notnull"`
}

FediAccount represents a federated social account.

func (*FediAccount) BeforeAppendModel

func (f *FediAccount) BeforeAppendModel(_ context.Context, query bun.Query) error

BeforeAppendModel runs before a bun append operation.

func (*FediAccount) GetAccessToken

func (f *FediAccount) GetAccessToken() (string, error)

GetAccessToken returns unencrypted access token.

func (*FediAccount) SetAccessToken

func (f *FediAccount) SetAccessToken(a string) error

SetAccessToken sets encrypted access token.

type FediInstance

type FediInstance struct {
	ID             int64     `validate:"-" bun:"id,pk,autoincrement"`
	CreatedAt      time.Time `validate:"-" bun:",nullzero,notnull,default:current_timestamp"`
	UpdatedAt      time.Time `validate:"-" bun:",nullzero,notnull,default:current_timestamp"`
	Domain         string    `validate:"-" bun:",nullzero,notnull,unique"`
	ActorURI       string    `validate:"url" bun:",nullzero,notnull"`
	ServerHostname string    `validate:"-" bun:",nullzero,notnull,unique"`
	Software       string    `validate:"-" bun:",nullzero,notnull"`
	ClientID       string    `validate:"-" bun:",nullzero"`
	ClientSecret   []byte    `validate:"-" bun:",nullzero"`
}

FediInstance represents a federated social instance.

func (*FediInstance) BeforeAppendModel

func (f *FediInstance) BeforeAppendModel(_ context.Context, query bun.Query) error

BeforeAppendModel runs before a bun append operation.

func (*FediInstance) GetClientSecret

func (f *FediInstance) GetClientSecret() (string, error)

GetClientSecret returns unencrypted client secret.

func (*FediInstance) SetClientSecret

func (f *FediInstance) SetClientSecret(s string) error

SetClientSecret sets encrypted client secret.

type OauthClient

type OauthClient struct {
	ID          int64        `validate:"-" bun:"id,pk,autoincrement"`
	CreatedAt   time.Time    `validate:"-" bun:",nullzero,notnull,default:current_timestamp"`
	UpdatedAt   time.Time    `validate:"-" bun:",nullzero,notnull,default:current_timestamp"`
	Secret      []byte       `validate:"-" bun:",nullzero,notnull"`
	RedirectURI string       `validate:"required,url" bun:",nullzero,notnull"`
	Description string       `validate:"-" bun:",nullzero,notnull"`
	OwnerID     int64        `validate:"-" bun:",nullzero,notnull"`
	Owner       *FediAccount `validate:"-" bun:"rel:belongs-to"`
}

OauthClient contains the oauth clients.

func (*OauthClient) BeforeAppendModel

func (f *OauthClient) BeforeAppendModel(_ context.Context, query bun.Query) error

BeforeAppendModel runs before a bun append operation.

func (*OauthClient) GetSecret

func (f *OauthClient) GetSecret() (string, error)

GetSecret returns unencrypted secret.

func (*OauthClient) SetSecret

func (f *OauthClient) SetSecret(s string) error

SetSecret sets encrypted secret.

type OauthScope

type OauthScope struct {
	ID          int64     `validate:"-" bun:"id,pk,autoincrement"`
	CreatedAt   time.Time `validate:"-" bun:",nullzero,notnull,default:current_timestamp"`
	UpdatedAt   time.Time `validate:"-" bun:",nullzero,notnull,default:current_timestamp"`
	Name        string    `validate:"required" bun:",nullzero,notnull"`
	Description string    `validate:"-" bun:",nullzero"`
	Default     bool      `validate:"-" bun:",notnull,default:false"`
}

OauthScope contains the oauth scopes.

func (*OauthScope) BeforeAppendModel

func (f *OauthScope) BeforeAppendModel(_ context.Context, query bun.Query) error

BeforeAppendModel runs before a bun append operation.

Jump to

Keyboard shortcuts

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