directaccesstoken

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateToken

func GenerateToken(length int) (string, error)

GenerateToken generates a random token of specified length in bytes

Types

type Filter

type Filter struct {
	ID           []uint64
	Token        []string
	UserID       []uint64
	AccountID    []uint64
	MinExpiresAt time.Time
	MaxExpiresAt time.Time
}

func (*Filter) PrepareQuery

func (fl *Filter) PrepareQuery(query *gorm.DB) *gorm.DB

type Order

type Order struct {
	ID        model.Order
	Token     model.Order
	UserID    model.Order
	AccountID model.Order
	CreatedAt model.Order
	ExpiresAt model.Order
}

func (*Order) PrepareQuery

func (ord *Order) PrepareQuery(query *gorm.DB) *gorm.DB

type Repository

type Repository interface {
	Get(ctx context.Context, id uint64) (*model.DirectAccessToken, error)
	GetByToken(ctx context.Context, token string) (*model.DirectAccessToken, error)
	FetchList(ctx context.Context, filter *Filter, order *Order, page *repository.Pagination) ([]*model.DirectAccessToken, error)
	Count(ctx context.Context, filter *Filter) (int64, error)
	Generate(ctx context.Context, userID, accountID uint64, description string, expiresAt time.Time) (*model.DirectAccessToken, error)
	Revoke(ctx context.Context, filter *Filter) error
}

type Usecase

type Usecase interface {
	Get(ctx context.Context, id uint64) (*model.DirectAccessToken, error)
	FetchList(ctx context.Context, filter *Filter, order *Order, page *repository.Pagination) ([]*model.DirectAccessToken, error)
	Count(ctx context.Context, filter *Filter) (int64, error)
	Generate(ctx context.Context, userID, accountID uint64, description string, expiresAt time.Time) (*model.DirectAccessToken, error)
	Revoke(ctx context.Context, filter *Filter) error
}

Directories

Path Synopsis
delivery

Jump to

Keyboard shortcuts

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