api_users

package
v0.0.0-...-ae67dfe Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2019 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const TableName = "api_users"

Variables

This section is empty.

Functions

This section is empty.

Types

type ApiUsers

type ApiUsers struct {
	Ctx        context.Context
	Collection *mongo.Collection
}

func New

func New(ac core.AppContext) *ApiUsers

func (*ApiUsers) CreateUser

func (au *ApiUsers) CreateUser(username string, userSecretHash string) (*ApiUsersDoc, error)

func (*ApiUsers) FindAll

func (au *ApiUsers) FindAll() (*[]ApiUsersDoc, error)

func (*ApiUsers) FindById

func (au *ApiUsers) FindById(id primitive.ObjectID) (*ApiUsersDoc, error)

func (*ApiUsers) FindByKey

func (au *ApiUsers) FindByKey(key string) (*ApiUsersDoc, error)

func (*ApiUsers) FindByName

func (au *ApiUsers) FindByName(username string) (*ApiUsersDoc, error)

func (*ApiUsers) UpdateLastLogin

func (au *ApiUsers) UpdateLastLogin(id primitive.ObjectID) error
"last_login": {
     "timestamp": NumberInt(1553735698),
     "hour": "2019-03-28 10",
     "day": "2019-03-28",
     "month": "2019-03",
     "year": "2019"
}

type ApiUsersDoc

type ApiUsersDoc struct {
	Id             primitive.ObjectID `bson:"_id" json:"_id"`
	Id2            string             `json:"id2"`
	UserName       string             `bson:"user_name" json:"user_name"`
	UserLevel      int64              `bson:"user_level" json:"user_level"`
	UserKey        string             `bson:"user_key" json:"user_key"`
	UserSecretHash string             `bson:"user_secret_hash" json:"user_secret_hash"`
	Mtime          int64              `bson:"mtime" json:"mtime"`
	Ctime          int64              `bson:"ctime" json:"ctime"`
	Status         int64              `bson:"status" json:"status"`
	LastLogin      *LastLogin         `bson:"last_login" json:"last_login"`
}

type LastLogin

type LastLogin struct {
	Timestamp int64 `bson:"timestamp" json:"timestamp"`

	Day   string `bson:"day" json:"day"`
	Month string `bson:"month" json:"month"`
	Year  string `bson:"year" json:"year"`
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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