tokens

package module
v1.0.30 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2023 License: Apache-2.0 Imports: 8 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrTokenNotFound = errors.Warning("tokens: token was not found")
)

Functions

func Remove

func Remove(ctx context.Context, param RemoveParam) (err errors.CodeError)

func Save

func Save(ctx context.Context, param SaveParam) (err errors.CodeError)

func Service

func Service(store Store) service.Service

Types

type RemoveParam

type RemoveParam struct {
	Id     string `json:"id"`
	UserId string `json:"userId"`
}

type SaveParam

type SaveParam struct {
	Id       string    `json:"id"`
	UserId   string    `json:"userId"`
	Token    string    `json:"token"`
	ExpireAT time.Time `json:"expireAt"`
}

type Store

type Store interface {
	Build(options StoreOptions) (err error)
	Save(ctx context.Context, param SaveParam) (err errors.CodeError)
	Remove(ctx context.Context, param RemoveParam) (err errors.CodeError)
	Get(ctx context.Context, id string) (token Token, has bool, err errors.CodeError)
	List(ctx context.Context, userId string) (tokens []Token, err errors.CodeError)
	Close()
}

type StoreOptions added in v1.0.30

type StoreOptions struct {
	AppId      string
	AppName    string
	AppVersion versions.Version
	Log        logs.Logger
	Config     configures.Config
}

type Token

type Token struct {
	Id       string    `json:"id"`
	UserId   string    `json:"userId"`
	Token    string    `json:"token"`
	ExpireAT time.Time `json:"expireAt"`
}

func Get

func Get(ctx context.Context, id string) (token Token, err errors.CodeError)

func List

func List(ctx context.Context, userId string) (tokens []Token, err errors.CodeError)

Directories

Path Synopsis
redis module
sql module

Jump to

Keyboard shortcuts

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