model

package
v0.0.0-...-2f69930 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Profile

type Profile struct {
	UserID     primitive.ObjectID `json:"user_id" bson:"_id" map:"_id"`
	Enable     bool               `json:"enable" bson:"enable" map:"enable"`
	CreateTime time.Time          `json:"create_time" bson:"create_time" map:"create_time"`
	UpdateTime time.Time          `json:"update_time" bson:"update_time" map:"update_time"`
}

type Token

type Token struct {
	ID          primitive.ObjectID `bson:"_id,omitempty" json:"_id" map:"_id"`
	UserID      primitive.ObjectID `bson:"user_id" json:"user_id" map:"user_id"`
	UserName    string             `bson:"user_name" json:"user_name" map:"user_name"`
	TokenType   string             `bson:"token_type" json:"token_type" map:"token_type"` //类型
	Token       string             `bson:"token" json:"token" map:"token"`
	SignInfo    TokenSignInfo      `bson:"sign_info" json:"sign_info" map:"sign_info"`
	ExpiredTime time.Time          `bson:"expired_time" json:"expired_time" map:"expired_time"` //过期时间
	CreateTime  time.Time          `bson:"create_time" json:"create_time" map:"create_time"`    //创建时间
	UpdateTime  time.Time          `bson:"update_time" json:"update_time" map:"update_time"`    //更新时间
}

type TokenSignInfo

type TokenSignInfo struct {
	IP        string         `bson:"ip" json:"ip" map:"ip"`
	UserAgent string         `bson:"user_agent" json:"user_agent" map:"user_agent"`
	Location  geometry.Point `bson:"location" json:"location,omitempty" map:"location,omitempty"`
}

type User

type User struct {
	ID             primitive.ObjectID `bson:"_id,omitempty" json:"user_id" map:"_id"`
	ExtensionID    int                `bson:"extension_id" json:"extension_id" map:"extension_id"` //扩展ID,0值代表无需和其他库同步,同步其他数据库时的自增ID,如mysql的user表的id
	Name           string             `bson:"name" json:"name" map:"name"`
	Password       string             `bson:"password" json:"-" map:"password"`
	SecurePassword string             `bson:"secure_password" json:"-" map:"secure_password"` //安全密码,提供二次验证使用
	Guest          bool               `bson:"guest" json:"guest" map:"guest"`                 //是否来宾
	Level          int                `json:"level" bson:"level" map:"level"`                 //总级别
	Experience     int                `json:"experience" bson:"experience" map:"experience"`  //总经验值
	Roles          []UserRole         `json:"roles" bson:"roles" map:"roles"`                 //用户身份角色
	Tags           []UserTag          `json:"tags" bson:"tags" map:"tags"`                    //用户身份标签
	Online         UserOnline         `json:"online" bson:"online" map:"online"`
	Location       geometry.Point     `json:"location" bson:"location,omitempty" map:"location,omitempty"`
	ExtraData      string             `json:"extra_data" bson:"extra_data" map:"extra_data"` //在用不到profile那么复杂的集合时,可额外扩展信息数据,可灵活使用,比如将相关额外信息json后存入
	Enable         bool               `bson:"enable" json:"enable" map:"enable"`
	Delete         bool               `bson:"delete" json:"delete" map:"delete"`
	CreateTime     time.Time          `bson:"create_time" json:"create_time" map:"create_time"` //创建时间
	UpdateTime     time.Time          `bson:"update_time" json:"update_time" map:"update_time"` //更新时间
}

type UserOnline

type UserOnline struct {
	Online      bool           `json:"online" bson:"online" map:"online"`
	Stealth     bool           `bson:"stealth" json:"stealth" map:"stealth"` //是否隐身
	IP          string         `json:"ip" bson:"ip" map:"ip"`
	Location    geometry.Point `json:"location" bson:"location,omitempty" map:"location,omitempty"`
	OnlineTime  time.Time      `json:"online_time" bson:"online_time" map:"online_time"`
	OfflineTime time.Time      `json:"offline_time" bson:"offline_time" map:"offline_time"`
}

type UserRole

type UserRole struct {
	Role       string    `json:"role" bson:"role" map:"role"`
	Level      int       `json:"level" bson:"level" map:"level"`
	Experience int       `json:"experience" bson:"experience" map:"experience"`
	StartTime  time.Time `json:"start_time" bson:"start_time" map:"start_time"`
	EndTime    time.Time `json:"end_time" bson:"end_time" map:"end_time"`
}

type UserTag

type UserTag struct {
	Tag        string    `json:"tag" bson:"tag" map:"tag"`
	Level      int       `json:"level" bson:"level" map:"level"`
	Experience int       `json:"experience" bson:"experience" map:"experience"`
	StartTime  time.Time `json:"start_time" bson:"start_time" map:"start_time"`
	EndTime    time.Time `json:"end_time" bson:"end_time" map:"end_time"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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