model

package
v0.1.65 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2023 License: Apache-2.0 Imports: 8 Imported by: 3

Documentation

Index

Constants

View Source
const (
	SUCCESS = 1
	ERROR   = 0
)

Variables

This section is empty.

Functions

This section is empty.

Types

type GenerateTokenFunc

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

func LoadFunctionMap

func LoadFunctionMap() GenerateTokenFunc

func (*GenerateTokenFunc) AddFunc

func (g *GenerateTokenFunc) AddFunc(key string, f HandlerFunc)

func (*GenerateTokenFunc) Exec

func (g *GenerateTokenFunc) Exec(tokenForm string) (string, error)

func (*GenerateTokenFunc) GetFunction

func (g *GenerateTokenFunc) GetFunction(tokenForm string) (HandlerFunc, error)

type HandlerFunc added in v0.1.3

type HandlerFunc func() (string, error)

type Login

type Login struct {
	Device          string
	IsLastingCookie bool
	Timeout         int64
	JwtData         map[string]interface{}
	Token           string
	IsWriteHeader   bool
}

func CreateLoginModelByDevice added in v0.1.7

func CreateLoginModelByDevice(device string) *Login

func DefaultLoginModel

func DefaultLoginModel() *Login

type QRCode added in v0.1.3

type QRCode struct {
	Id      string
	State   QRCodeState
	LoginId string
	Ticket  string
}

func NewQRCode added in v0.1.3

func NewQRCode(id string) *QRCode

type QRCodeState added in v0.1.3

type QRCodeState int
const (
	WaitScan    QRCodeState = 1
	WaitAuth    QRCodeState = 2
	ConfirmAuth QRCodeState = 3
	CancelAuth  QRCodeState = 4
	Expired     QRCodeState = 5
)

QRCode State

type Result added in v0.0.6

type Result struct {
	Code int
	Msg  string
	Data interface{}
}

Result wrap the http request result.

func Error added in v0.0.6

func Error() *Result

func Ok added in v0.0.6

func Ok() *Result

func (*Result) SetData added in v0.0.6

func (r *Result) SetData(data interface{}) *Result

func (*Result) SetMsg added in v0.0.6

func (r *Result) SetMsg(msg string) *Result

type Session

type Session struct {
	Id            string
	Type          string
	LoginType     string
	LoginId       string
	Token         string
	CreateTime    int64
	DataMap       map[string]interface{}
	TokenSignList []*TokenSign `json:"TokenSignList"`
}

func DefaultSession

func DefaultSession(id string) *Session

func NewSession

func NewSession(id string, sessionType string, loginId string) *Session

func (*Session) AddTokenSign

func (s *Session) AddTokenSign(sign *TokenSign)

AddTokenSign add TokenSign

func (*Session) Get added in v0.0.6

func (s *Session) Get(key string) interface{}

Get returns data from DataMap

func (*Session) GetFilterTokenSign

func (s *Session) GetFilterTokenSign(device string) *list.List

GetFilterTokenSign filter by TokenSign.Device from all TokenSign

func (*Session) GetFilterTokenSignSlice added in v0.1.7

func (s *Session) GetFilterTokenSignSlice(device string) []*TokenSign

func (*Session) GetLastTokenByDevice

func (s *Session) GetLastTokenByDevice(device string) string

GetLastTokenByDevice get TokenSign.Value by device

func (*Session) GetOrSet added in v0.0.6

func (s *Session) GetOrSet(key string, obj interface{}) (interface{}, bool)

GetOrSet returns the existing value for the key if present. Otherwise, it stores and returns the given value. The loaded result is true if the value was loaded, false if stored.

func (*Session) GetTokenSign

func (s *Session) GetTokenSign(tokenValue string) *TokenSign

GetTokenSign find TokenSign by TokenSign.Value

func (*Session) GetTokenSignListCopy

func (s *Session) GetTokenSignListCopy() *list.List

GetTokenSignListCopy find all TokenSign

func (*Session) Json added in v0.0.4

func (s *Session) Json() string

Json return json string

func (*Session) RemoveTokenSign

func (s *Session) RemoveTokenSign(tokenValue string) bool

RemoveTokenSign remove TokenSign by TokenSign.Value

func (*Session) RemoveTokenSignByIndex added in v0.0.4

func (s *Session) RemoveTokenSignByIndex(i int)

RemoveTokenSignByIndex delete by index

func (*Session) Set added in v0.0.6

func (s *Session) Set(key string, obj interface{})

func (*Session) String added in v0.1.3

func (s *Session) String() string

func (*Session) TokenSignSize added in v0.0.4

func (s *Session) TokenSignSize() int

TokenSignSize get tokenSign size

type SyncSession added in v0.0.6

type SyncSession struct {
	Id            string
	Type          string
	LoginType     string
	LoginId       string
	Token         string
	CreateTime    int64
	DataMap       *sync.Map
	TokenSignList []*TokenSign `json:"TokenSignList"`
}

SyncSession sync SyncSession

func ConvertSyncSession added in v0.0.6

func ConvertSyncSession(s *Session) *SyncSession

ConvertSyncSession convert to Session

func DefaultSyncSession added in v0.0.6

func DefaultSyncSession(id string) *SyncSession

func JsonByteToSyncSession added in v0.0.6

func JsonByteToSyncSession(jsonByte []byte) (*SyncSession, error)

func JsonToSyncSession added in v0.0.6

func JsonToSyncSession(jsonStr string) (*SyncSession, error)

func NewSyncSession added in v0.0.6

func NewSyncSession(id string, sessionType string, loginId string) *SyncSession

func (*SyncSession) AddTokenSign added in v0.0.6

func (s *SyncSession) AddTokenSign(sign *TokenSign)

AddTokenSign add TokenSign

func (*SyncSession) Get added in v0.0.6

func (s *SyncSession) Get(key string) interface{}

Get returns data from DataMap

func (*SyncSession) GetFilterTokenSign added in v0.0.6

func (s *SyncSession) GetFilterTokenSign(device string) *list.List

GetFilterTokenSign filter by TokenSign.Device from all TokenSign

func (*SyncSession) GetLastTokenByDevice added in v0.0.6

func (s *SyncSession) GetLastTokenByDevice(device string) string

GetLastTokenByDevice get TokenSign.Value by device

func (*SyncSession) GetOrSet added in v0.0.6

func (s *SyncSession) GetOrSet(key string, obj interface{}) (interface{}, bool)

GetOrSet returns the existing value for the key if present. Otherwise, it stores and returns the given value. The loaded result is true if the value was loaded, false if stored.

func (*SyncSession) GetTokenSign added in v0.0.6

func (s *SyncSession) GetTokenSign(tokenValue string) *TokenSign

GetTokenSign find TokenSign by TokenSign.Value

func (*SyncSession) GetTokenSignListCopy added in v0.0.6

func (s *SyncSession) GetTokenSignListCopy() *list.List

GetTokenSignListCopy find all TokenSign

func (*SyncSession) Json added in v0.0.6

func (s *SyncSession) Json() string

Json return json string

func (*SyncSession) RemoveTokenSign added in v0.0.6

func (s *SyncSession) RemoveTokenSign(tokenValue string) bool

RemoveTokenSign remove TokenSign by TokenSign.Value

func (*SyncSession) RemoveTokenSignByIndex added in v0.0.6

func (s *SyncSession) RemoveTokenSignByIndex(i int)

RemoveTokenSignByIndex delete by index

func (*SyncSession) Set added in v0.0.6

func (s *SyncSession) Set(key string, obj interface{})

func (*SyncSession) TokenSignSize added in v0.0.6

func (s *SyncSession) TokenSignSize() int

TokenSignSize get tokenSign size

func (*SyncSession) UnmarshalBytes added in v0.0.6

func (s *SyncSession) UnmarshalBytes(jsonByte []byte) (*SyncSession, error)

UnmarshalBytes convert bytes to SyncSession

func (*SyncSession) UnmarshalStr added in v0.0.6

func (s *SyncSession) UnmarshalStr(jsonStr string) (*SyncSession, error)

UnmarshalStr convert string to SyncSession

type TokenSign

type TokenSign struct {
	Value  string
	Device string
}

func (*TokenSign) String added in v0.1.3

func (t *TokenSign) String() string

Jump to

Keyboard shortcuts

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