endpoint

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	AddrURL    string                 // 服务器地址 http://abc.cn/api/auth/store
	Middleware goutapi.RequestMiddler // 可以增加远程调用规则和权限
}

Config 配置

type ResResult

type ResResult struct {
	Success    bool        `json:"success"`
	ErrMessage string      `json:"errmsg"`
	ErrCode    string      `json:"errcode"`
	Data       interface{} `json:"data"`
}

ResResult 用于解析 服务端 返回的http body

type Store

type Store struct {
	// contains filtered or unexported fields
}

Store redis存储

func NewStore

func NewStore(cfg *Config) *Store

NewStore store

func (*Store) Check

func (s *Store) Check(ctx context.Context, key string) (bool, error)

Check 检查令牌是否存在

func (*Store) Close

func (s *Store) Close() error

Close 关闭存储

func (*Store) Delete

func (s *Store) Delete(ctx context.Context, key string) error

Delete ...

func (*Store) Get

func (s *Store) Get(ctx context.Context, key string) (string, bool, error)

Get ...

func (*Store) Set

func (s *Store) Set(ctx context.Context, key, value string, expiration time.Duration) error

Set ...

func (*Store) Set1

func (s *Store) Set1(ctx context.Context, key string, expiration time.Duration) error

Set1 存储令牌数据,并指定到期时间

Jump to

Keyboard shortcuts

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