authz

package
v0.53.0 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateWookieMiddleware added in v0.43.0

func GenerateWookieMiddleware(wookieSvc *WookieService) service.Middleware

Types

type Model

type Model interface {
	GetID() int64
	GetVersion() int64
	GetCreatedAt() time.Time
	ToToken() *wookie.Token
}

type MySQLRepository

type MySQLRepository struct {
	database.SQLRepository
}

func NewMySQLRepository

func NewMySQLRepository(db *database.MySQL) *MySQLRepository

func (MySQLRepository) Create

func (repo MySQLRepository) Create(ctx context.Context, version int64) (int64, error)

func (MySQLRepository) GetById

func (repo MySQLRepository) GetById(ctx context.Context, id int64) (Model, error)

func (MySQLRepository) GetLatest

func (repo MySQLRepository) GetLatest(ctx context.Context) (Model, error)

type PostgresRepository

type PostgresRepository struct {
	database.SQLRepository
}

func NewPostgresRepository

func NewPostgresRepository(db *database.Postgres) *PostgresRepository

func (PostgresRepository) Create

func (repo PostgresRepository) Create(ctx context.Context, version int64) (int64, error)

func (PostgresRepository) GetById

func (repo PostgresRepository) GetById(ctx context.Context, id int64) (Model, error)

func (PostgresRepository) GetLatest

func (repo PostgresRepository) GetLatest(ctx context.Context) (Model, error)

type SQLiteRepository

type SQLiteRepository struct {
	database.SQLRepository
}

func NewSQLiteRepository

func NewSQLiteRepository(db *database.SQLite) *SQLiteRepository

func (SQLiteRepository) Create

func (repo SQLiteRepository) Create(ctx context.Context, version int64) (int64, error)

func (SQLiteRepository) GetById

func (repo SQLiteRepository) GetById(ctx context.Context, id int64) (Model, error)

func (SQLiteRepository) GetLatest

func (repo SQLiteRepository) GetLatest(ctx context.Context) (Model, error)

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 (w Wookie) GetCreatedAt() time.Time

func (Wookie) GetID

func (w Wookie) GetID() int64

func (Wookie) GetVersion

func (w Wookie) GetVersion() int64

func (Wookie) ToToken

func (w Wookie) ToToken() *wookie.Token

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
}

func NewService

func NewService(env service.Env, repository WookieRepository) *WookieService

func (WookieService) CreateNewWookie added in v0.39.0

func (svc WookieService) CreateNewWookie(ctx context.Context) (*wookie.Token, error)

func (WookieService) GetById added in v0.39.0

func (svc WookieService) GetById(ctx context.Context, id int64) (*wookie.Token, error)

func (WookieService) GetLatestWookie added in v0.39.0

func (svc WookieService) GetLatestWookie(ctx context.Context) (*wookie.Token, error)

func (WookieService) WithNewWookie added in v0.42.0

func (svc WookieService) WithNewWookie(ctx context.Context, txWookieFunc func(context.Context) error) (*wookie.Token, error)

Jump to

Keyboard shortcuts

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