games

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const OnetimeTokenExpireDuration = 60 * 60 * 6

Variables

View Source
var OnetimeTokenExpireIndex = mongo.IndexModel{
	Keys:    bson.D{{"generated_at", -1}},
	Options: options.Index().SetName("idx_expire").SetExpireAfterSeconds(OnetimeTokenExpireDuration + 60),
}
View Source
var OnetimeTokenHayabusaIndex = mongo.IndexModel{
	Keys:    bson.D{{"hayabusa_id", -1}},
	Options: options.Index().SetName("idx_hayabusa_id"),
}
View Source
var OnetimeTokenIndex = mongo.IndexModel{
	Keys:    bson.D{{"token", -1}},
	Options: options.Index().SetName("idx_onetime_token").SetUnique(true),
}
View Source
var PlayerIndex = mongo.IndexModel{
	Keys:    bson.D{{"hayabusa_id", -1}},
	Options: options.Index().SetName("idx_hayabusa_id").SetUnique(true),
}

PlayerIndex declares index of Player

Functions

func NewOnetimeToken

func NewOnetimeToken() string

NewOnetimeToken generates onetime token of user

Types

type MsgOnetimeToken

type MsgOnetimeToken struct {
	Token       string    `json:"token"`
	ExpireUntil hybs.Time `json:"expireUntil"`
}

type OnetimeToken

type OnetimeToken struct {
	HayabusaID  string    `bson:"hayabusa_id"`
	ServerID    string    `bson:"server_id"`
	Token       string    `bson:"token"`
	Permission  uint8     `bson:"permission"`
	GeneratedAt hybs.Time `bson:"generated_at"`
}

func (*OnetimeToken) ToMsg

func (token *OnetimeToken) ToMsg() *MsgOnetimeToken

type PlayerBase

type PlayerBase struct {
	HayabusaID string    `bson:"hayabusa_id" json:"hayabusaId"` // アプリケーション層プライマリキー
	SignUpAt   hybs.Time `bson:"sign_up_at"  json:"signUpAt"`   // 登録日時
	BanUntil   hybs.Time `bson:"ban_until"   json:"banUntil"`   // 凍結期限
}

Jump to

Keyboard shortcuts

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