Documentation
¶
Index ¶
Constants ¶
View Source
const WarrantTokenHeaderName = "Warrant-Token"
Variables ¶
This section is empty.
Functions ¶
func AddAsResponseHeader ¶
func AddAsResponseHeader(w http.ResponseWriter, token *Token)
Types ¶
type MySQLRepository ¶
type MySQLRepository struct {
database.SQLRepository
}
func NewMySQLRepository ¶
func NewMySQLRepository(db *database.MySQL) MySQLRepository
type PostgresRepository ¶
type PostgresRepository struct {
database.SQLRepository
}
func NewPostgresRepository ¶
func NewPostgresRepository(db *database.Postgres) PostgresRepository
type SQLiteRepository ¶
type SQLiteRepository struct {
database.SQLRepository
}
func NewSQLiteRepository ¶
func NewSQLiteRepository(db *database.SQLite) SQLiteRepository
type Token ¶
func FromString ¶
De-serialize token from string (from header)
type Wookie ¶
type Wookie struct {
ID int64 `mysql:"id" postgres:"id" sqlite:"id"`
Version int64 `mysql:"ver" postgres:"ver" sqlite:"ver"`
CreatedAt time.Time `mysql:"createdAt" postgres:"created_at" sqlite:"createdAt"`
}
func (Wookie) GetCreatedAt ¶
func (Wookie) GetVersion ¶
type WookieRepository ¶
type WookieRepository interface {
Create(ctx context.Context, version int64) (int64, error)
GetById(ctx context.Context, id int64) (Model, error)
GetLatest(ctx context.Context) (Model, error)
}
func NewRepository ¶
func NewRepository(db database.Database) (WookieRepository, error)
type WookieService ¶
type WookieService struct {
service.BaseService
Repository WookieRepository
Enabled bool
}
func NewService ¶
func NewService(env service.Env, repository WookieRepository, enabled bool) WookieService
func (WookieService) WithWookieUpdate ¶
func (svc WookieService) WithWookieUpdate(ctx context.Context, updateFunc func(txCtx context.Context) error) (*Token, error)
Apply given updateFunc() and create a new wookie for this update. Returns the new wookie token.
func (WookieService) WookieSafeRead ¶
Click to show internal directories.
Click to hide internal directories.