model

package
v0.14.1 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2026 License: MIT Imports: 2 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Base

type Base struct {
	ID        string     `json:"uuid"       msgpack:"id"         storm:"id"`
	CreatedAt *time.Time `json:"created_at" msgpack:"created_at" storm:"index"`
	UpdatedAt *time.Time `json:"updated_at" msgpack:"updated_at" storm:"index"`
}

A Base contains the default model fields.

func (*Base) GetCreatedAt

func (m *Base) GetCreatedAt() *time.Time

GetCreatedAt returns the model's creation date.

func (*Base) GetID

func (m *Base) GetID() string

GetID returns the model's ID.

func (*Base) GetUpdatedAt

func (m *Base) GetUpdatedAt() *time.Time

GetUpdatedAt returns the model's last update date.

func (*Base) SetCreatedAt

func (m *Base) SetCreatedAt(t time.Time)

SetCreatedAt defines the model's creation date.

func (*Base) SetID

func (m *Base) SetID(id string)

SetID defines the model's ID.

func (*Base) SetUpdatedAt

func (m *Base) SetUpdatedAt(t time.Time)

SetUpdatedAt defines the model's last update date.

type Item

type Item struct {
	Base `msgpack:",inline" storm:"inline"`

	EditedAt         *time.Time `json:"edited_at" msgpack:"edited_at" storm:"index"`
	UserID           string     `json:"user_uuid"    msgpack:"user_id"                 storm:"index"`
	ItemsKeyID       string     `json:"items_key_id" msgpack:"items_key_id,omitempty"`
	Content          string     `json:"content"      msgpack:"content"`
	ContentType      string     `json:"content_type" msgpack:"content_type"            storm:"index"`
	EncryptedItemKey string     `json:"enc_item_key" msgpack:"enc_item_key"`
	Deleted          bool       `json:"deleted"      msgpack:"deleted"                 storm:"index"`
}

A Item represents a database record and the rendered API response.

type Model

type Model interface {
	// GetID returns the model's ID.
	GetID() string
	// SetID defines the model's ID.
	SetID(string)
	// GetCreatedAt returns the model's creation date.
	GetCreatedAt() *time.Time
	// SetCreatedAt defines the model's creation date.
	SetCreatedAt(time.Time)
	// GetUpdatedAt returns the model's last update date.
	GetUpdatedAt() *time.Time
	// SetUpdatedAt defines the model's last update date.
	SetUpdatedAt(time.Time)
}

A Model defines an object that can be stored in database.

type PKCE added in v0.7.0

type PKCE struct {
	Base `msgpack:",inline" storm:"inline"`

	CodeChallenge string    `msgpack:"code_challenge"       storm:"index"`
	ExpireAt      time.Time `msgpack:"expire_at"`
}

A PKCE represents a database record.

type Session added in v0.6.0

type Session struct {
	Base `msgpack:",inline" storm:"inline"`

	ExpireAt     time.Time `msgpack:"expire_at"`
	UserID       string    `msgpack:"user_id"       storm:"index"`
	UserAgent    string    `msgpack:"user_agent"`
	APIVersion   string    `msgpack:"api_version"`
	AccessToken  string    `msgpack:"access_token"  storm:"index"`
	RefreshToken string    `msgpack:"refresh_token"`

	// Custom fields
	Current bool `msgpack:"-"`
}

A Session represents a database record.

type User

type User struct {
	Base `msgpack:",inline" storm:"inline"`

	// Standardfile fields
	Email         string `msgpack:"email"    storm:"unique"`
	Password      string `msgpack:"password,omitempty"`
	PasswordCost  int    `msgpack:"pw_cost,omitempty"`
	PasswordNonce string `msgpack:"pw_nonce,omitempty"`
	PasswordAuth  string `msgpack:"pw_auth,omitempty"`
	Version       string `msgpack:"version"`

	// V2 flields compatibility
	PasswordSalt string `msgpack:"pw_salt,omitempty"`

	// Custom fields
	PasswordUpdatedAt int64 `msgpack:"password_updated_at"`
}

A User represents a database record.

func NewUser

func NewUser() *User

NewUser returns a new user with default params.

Jump to

Keyboard shortcuts

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