models

package
v0.0.0-...-5767ed4 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: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TransactionTypeCouncilInit       TransactionType = "COUNCIL_INIT"
	TransactionTypeCouncilInitString string          = "Council initialized with members: %s"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Block

type Block 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"`
}

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:",nullzero"`
	LastFinger  time.Time     `validate:"-" bun:",notnull"`
	LogInCount  int64         `validate:"-" bun:",notnull"`
	LogInLast   time.Time     `validate:"-" bun:",nullzero"`
	IsAdmin     bool          `validate:"-" bun:",notnull"`
	IsCouncil   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) GetActorURI

func (f *FediAccount) GetActorURI() (actorURI string)

GetActorURI returns the account's actor uri.

func (*FediAccount) GetDisplayName

func (f *FediAccount) GetDisplayName() (displayName string)

GetDisplayName returns the account's display name.

func (*FediAccount) GetID

func (f *FediAccount) GetID() (accountID int64)

GetID returns the account's database id.

func (*FediAccount) GetInstance

func (f *FediAccount) GetInstance() (instance fedihelper.Instance)

GetInstance returns the instance of the account.

func (*FediAccount) GetLastFinger

func (f *FediAccount) GetLastFinger() (lastFinger time.Time)

GetLastFinger returns the time of the last finger.

func (*FediAccount) GetUsername

func (f *FediAccount) GetUsername() (username string)

GetUsername returns the account's username.

func (*FediAccount) SetActorURI

func (f *FediAccount) SetActorURI(actorURI string)

SetActorURI sets the account's actor uri.

func (*FediAccount) SetDisplayName

func (f *FediAccount) SetDisplayName(displayName string)

SetDisplayName sets the account's display name.

func (*FediAccount) SetInstance

func (f *FediAccount) SetInstance(instanceI fedihelper.Instance)

SetInstance sets the instance of the account.

func (*FediAccount) SetLastFinger

func (f *FediAccount) SetLastFinger(lastFinger time.Time)

SetLastFinger sets the time of the last finger.

func (*FediAccount) SetUsername

func (f *FediAccount) SetUsername(username string)

SetUsername sets the account's username.

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"`
}

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

func (f *FediInstance) GetActorURI() (actorURI string)

func (*FediInstance) GetDomain

func (f *FediInstance) GetDomain() (domain string)

func (*FediInstance) GetID

func (f *FediInstance) GetID() (instanceID int64)

func (*FediInstance) GetServerHostname

func (f *FediInstance) GetServerHostname() (hostname string)

func (*FediInstance) GetSoftware

func (f *FediInstance) GetSoftware() (software string)

func (*FediInstance) SetActorURI

func (f *FediInstance) SetActorURI(actorURI string)

func (*FediInstance) SetDomain

func (f *FediInstance) SetDomain(domain string)

func (*FediInstance) SetServerHostname

func (f *FediInstance) SetServerHostname(hostname string)

func (*FediInstance) SetSoftware

func (f *FediInstance) SetSoftware(software string)

type Transaction

type Transaction struct {
	ID        int64           `validate:"-" bun:"id,pk,autoincrement"`
	CreatedAt time.Time       `validate:"-" bun:",nullzero,notnull,default:current_timestamp"`
	Type      TransactionType `validate:"-" bun:",nullzero,notnull"`
	MetaData  string          `validate:"-" bun:",nullzero,notnull"`
}

Transaction represents a transaction lgo entry.

func (*Transaction) BeforeAppendModel

func (t *Transaction) BeforeAppendModel(_ context.Context, query bun.Query) error

BeforeAppendModel runs before a bun append operation.

func (*Transaction) GetMetaData

func (t *Transaction) GetMetaData(i interface{}) error

GetMetaData marshals metadata into json and adds it to transaction.

func (*Transaction) SetMetaData

func (t *Transaction) SetMetaData(i interface{}) error

SetMetaData marshals metadata into json and adds it to transaction.

type TransactionCouncilInit

type TransactionCouncilInit struct {
	Members []TransactionCouncilInitMember `json:"members"`
}

func (*TransactionCouncilInit) String

func (t *TransactionCouncilInit) String() string

type TransactionCouncilInitMember

type TransactionCouncilInitMember struct {
	DBID int64  `json:"db_id"`
	Name string `json:"name"`
}

type TransactionType

type TransactionType string

Jump to

Keyboard shortcuts

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