Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Collection ¶
type Collection struct {
validation.ValidateStructMixin
bun.BaseModel `bun:"table:collections"`
ID string `bun:"id,pk" json:"id"`
Name string `bun:"name,notnull" json:"name" validate:"required,collection_name"`
CreatedAt time.Time `bun:"created_at,nullzero,notnull,default:current_timestamp" json:"created_at"`
UpdatedAt time.Time `bun:"updated_at,nullzero,notnull,default:current_timestamp" json:"updated_at"`
Items []*Item `bun:"rel:has-many,join:id=collection_id" json:"omitzero"`
}
func (*Collection) Aggregate ¶
func (collection *Collection) Aggregate() (aggregate.Aggregate, error)
func (*Collection) BeforeAppendModel ¶
BeforeAppendModel implements schema.BeforeAppendModelHook.
func (*Collection) MarshalJSON ¶
func (collection *Collection) MarshalJSON() ([]byte, error)
type CollectionWithItemsCount ¶
type CollectionWithItemsCount struct {
Collection
ItemsCount int `bun:"items_count"`
}
type Collections ¶
type Collections []*CollectionWithItemsCount
type Item ¶
type Item struct {
validation.ValidateStructMixin
bun.BaseModel `bun:"table:items,alias:i"`
ID string `bun:"id,pk" validate:"required,ulid"`
Content []byte `bun:"content,notnull" validate:"required"`
Hash string `bun:"hash,notnull" validate:"required,sha256"`
Mimetype string `bun:"mimetype,notnull" validate:"required,mimetype"`
LastAppliedSequenceID int64 `bun:"last_applied_sequence_id,notnull" validate:"gte=0"`
CreatedAt time.Time `bun:"created_at,nullzero,notnull,default:current_timestamp"`
UpdatedAt time.Time `bun:"updated_at,nullzero,notnull,default:current_timestamp"`
CollectionID sql.NullString `bun:"collection_id"`
Collection *Collection `bun:"rel:belongs-to,join:collection_id=id"`
}
Click to show internal directories.
Click to hide internal directories.