user

package
v0.0.0-...-f6d4ea8 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2019 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CacheAppPrefix = "light.app"

	CollectionApp = "app"
)
View Source
const (
	SessionClientWeb     = 0
	SessionClientAndroid = 1
	SessionClientIOS     = 2
)
View Source
const (
	CollectionToken = "token"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type App

type App struct {
	Id             primitive.ObjectID `bson:"_id,omitempty" json:"-"`
	AppId          string             `bson:"appId" json:"app_id"`
	SecretKey      string             `bson:"secretKey" json:"secret_key"`
	Name           string             `bson:"name" json:"name"`
	AllowAnonymous bool               `bson:"allowAnonymous" json:"allow_anonymous"`
	AllowStranger  bool               `bson:"allowStranger" json:"allow_stranger"`
	UTime          time.Time          `bson:"utime" json:"utime"`
	CTime          time.Time          `bson:"ctime" json:"ctime"`
}

func CreateApp

func CreateApp(name string, allowAnonymous, allowStranger bool) (*App, error)

func GetAppById

func GetAppById(appId string) (*App, error)

type Token

type Token struct {
	Id     primitive.ObjectID `bson:"_id,omitempty" json:"id"`
	AppId  string             `bson:"appId" json:"app_id"`
	UserId string             `bson:"userId" json:"user_id"`
	Token  string             `bson:"token" json:"token"`
	Client string             `bson:"client" json:"client"`
	UTime  time.Time          `bson:"utime" json:"utime"`
	CTime  time.Time          `bson:"ctime" json:"ctime"`
}

func CreateToken

func CreateToken(appId, userId, client, token string) (*Token, error)

func GetTokenWithClient

func GetTokenWithClient(token, client string) (*Token, error)

Jump to

Keyboard shortcuts

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