Documentation ¶
Index ¶
- Constants
- Variables
- func ValueConvertNameToType(t string) uint8
- type Backend
- type BackendCryptAES
- type BackendJose
- type Body
- type Encoder
- type JoseConfig
- type SecretKey
- type StandartEncoder
- type Token
- func (b *Token) Delete(key string) (ok bool, err error)
- func (b *Token) GetBool(key string) (val bool, exist bool, err error)
- func (b *Token) GetFloat32(key string) (val float32, exist bool, err error)
- func (b *Token) GetFloat64(key string) (val float64, exist bool, err error)
- func (b *Token) GetInt(key string) (val int, exist bool, err error)
- func (b *Token) GetInt64(key string) (val int64, exist bool, err error)
- func (b *Token) GetRaw(key string) (val *Value, exist bool, err error)
- func (b *Token) GetString(key string) (val string, exist bool, err error)
- func (b *Token) GetTokenCreateTime() int64
- func (b *Token) GetTokenID() string
- func (b *Token) GetTokenUpdateTime() int64
- func (b *Token) IsKeyExist(key string) (exist bool)
- func (b *Token) Iterator(fn func(string, *Value, error))
- func (t *Token) MarshalString() (string, error)
- func (b *Token) SetBool(key string, val bool) (err error)
- func (b *Token) SetFloat32(key string, val float32) (err error)
- func (b *Token) SetFloat64(key string, val float64) (err error)
- func (b *Token) SetInt(key string, val int) (err error)
- func (b *Token) SetInt64(key string, val int64) (err error)
- func (b *Token) SetRaw(key string, value interface{}) (err error)
- func (b *Token) SetString(key string, val string) (err error)
- func (b *Token) UpBool(key string, val bool) (err error)
- func (b *Token) UpFloat32(key string, val float32) (err error)
- func (b *Token) UpFloat64(key string, val float64) (err error)
- func (b *Token) UpInt(key string, val int) (err error)
- func (b *Token) UpInt64(key string, val int64) (err error)
- func (b *Token) UpRaw(key string, value interface{}) (err error)
- func (b *Token) UpString(key string, val string) (err error)
- type Value
Constants ¶
View Source
const ( Int = iota Int64 Float32 Float64 String Bool )
View Source
const LEN_TOKEN_ID = 36
Variables ¶
View Source
var ( ERR_KEY_EXIST = errors.New("key exist") ERR_KEY_NOT_EXIST = errors.New("key not exist") ERR_KEY_INVALID_TYPE = errors.New("key invalid type") ERR_KEY_INVALID_VALUE = errors.New("key invalid value") )
View Source
var (
ERR_SIZE_MORE = errors.New("token size is more than 4 kb")
)
Functions ¶
func ValueConvertNameToType ¶ added in v0.2.1
Types ¶
type Backend ¶ added in v0.2.1
func NewBackendCryptAES ¶ added in v0.2.1
NewBackendCryptAES and returns a new *token.CryptAES. The key argument should be the AES key, either 16, 24, or 32 bytes to select AES-128, AES-192, or AES-256.
func NewBackendJose ¶ added in v0.2.1
func NewBackendJose(cfg *JoseConfig, key SecretKey) (Backend, error)
type BackendCryptAES ¶ added in v0.2.1
type BackendCryptAES struct {
// contains filtered or unexported fields
}
type BackendJose ¶ added in v0.2.1
type BackendJose struct {
// contains filtered or unexported fields
}
type Body ¶
type Body struct { ID string `json:"tok_id"` UpTime int64 `json:"up_time"` CreateTime int64 `json:"cr_time"` S map[string]*Value `json:"val"` // contains filtered or unexported fields }
func (Body) MarshalEasyJSON ¶ added in v0.2.1
MarshalEasyJSON supports easyjson.Marshaler interface
func (Body) MarshalJSON ¶ added in v0.2.1
MarshalJSON supports json.Marshaler interface
func (*Body) UnmarshalEasyJSON ¶ added in v0.2.1
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*Body) UnmarshalJSON ¶ added in v0.2.1
UnmarshalJSON supports json.Unmarshaler interface
type Encoder ¶
type Encoder interface { NewToken() *Token UnmarshalString(string) (*Token, error) MarshalString(*Token) (string, error) }
func NewEncoder ¶
type JoseConfig ¶ added in v0.2.1
type StandartEncoder ¶ added in v0.2.1
type StandartEncoder struct {
// contains filtered or unexported fields
}
func (*StandartEncoder) MarshalString ¶ added in v0.2.1
func (e *StandartEncoder) MarshalString(tok *Token) (raw string, err error)
func (*StandartEncoder) NewToken ¶ added in v0.2.1
func (e *StandartEncoder) NewToken() (tok *Token)
func (*StandartEncoder) UnmarshalString ¶ added in v0.2.1
func (e *StandartEncoder) UnmarshalString(str string) (tok *Token, err error)
type Token ¶
type Token struct {
// contains filtered or unexported fields
}
func (*Token) GetFloat32 ¶ added in v0.2.1
func (*Token) GetFloat64 ¶ added in v0.2.1
func (*Token) GetTokenCreateTime ¶ added in v0.2.1
func (*Token) GetTokenID ¶ added in v0.2.1
func (*Token) GetTokenUpdateTime ¶ added in v0.2.1
func (*Token) IsKeyExist ¶ added in v0.2.1
func (*Token) MarshalString ¶
func (*Token) SetFloat32 ¶ added in v0.2.1
func (*Token) SetFloat64 ¶ added in v0.2.1
Click to show internal directories.
Click to hide internal directories.