redisservice

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SessionService

type SessionService struct {
	*redis.Client
	// contains filtered or unexported fields
}

func NewSessionService

func NewSessionService(name string, client *redis.Client) *SessionService

func (SessionService) AutoMigrate

func (s SessionService) AutoMigrate(ctx context.Context) error

func (SessionService) Counter

func (s SessionService) Counter(ctx context.Context, seed string, expireTime *time.Time, num ...int64) (err error)

func (SessionService) CreateToken

func (s SessionService) CreateToken(ctx context.Context, token *models.Token) error

func (SessionService) DeleteToken

func (s SessionService) DeleteToken(ctx context.Context, tokenType models.TokenType, id string) (err error)

func (SessionService) GetCounter

func (s SessionService) GetCounter(ctx context.Context, seed string) (count int64, err error)

func (SessionService) GetSessions

func (s SessionService) GetSessions(ctx context.Context, userId string, current int64, pageSize int64) (int64, []*models.Token, error)

func (SessionService) GetToken

func (s SessionService) GetToken(ctx context.Context, tokenId string, tokenType models.TokenType, relationId ...string) (*models.Token, error)

func (SessionService) Name

func (s SessionService) Name() string

func (SessionService) RefreshOAuthTokenByAuthorizationCode

func (s SessionService) RefreshOAuthTokenByAuthorizationCode(ctx context.Context, token, clientId, clientSecret string) (accessToken, refreshToken string, expiresIn int, err error)

func (SessionService) RefreshOAuthTokenByPassword

func (s SessionService) RefreshOAuthTokenByPassword(ctx context.Context, token, username, password string) (accessToken, refreshToken string, expiresIn int, err error)

func (SessionService) UpdateToken

func (s SessionService) UpdateToken(ctx context.Context, token *models.Token) error

func (SessionService) UpdateTokenExpires

func (s SessionService) UpdateTokenExpires(ctx context.Context, id string, expiry time.Time) error

type Token

type Token struct {
	Id          string           `json:"id"`
	CreateTime  time.Time        `json:"createTime"`
	Data        string           `json:"data,omitempty"`
	RelationId  string           `json:"relationId"`
	Expiry      time.Time        `json:"expiry"`
	Type        models.TokenType `json:"type"`
	LastSeen    time.Time        `json:"lastSeen"`
	ParentId    string           `json:"parentId,omitempty"`
	Childrens   []*Token         `json:"-"`
	ChildrensId []string         `json:"childrensId,omitempty"`
}

func NewToken

func NewToken(token *models.Token) *Token

func (*Token) MarshalBinary

func (s *Token) MarshalBinary() (data []byte, err error)

func (*Token) ToToken

func (s *Token) ToToken() *models.Token

func (*Token) UnmarshalBinary

func (s *Token) UnmarshalBinary(data []byte) error

Jump to

Keyboard shortcuts

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