user

package
v0.9.29 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2019 License: BSD-2-Clause Imports: 5 Imported by: 11

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AdminGet

func AdminGet(u *Users) (err error)

func Initialize

func Initialize() (err error)

Initialize creates a copy of the mongodb connection and then uses that connection to create the Users collection in mongodb. Then, it ensures that there is a unique index on the uuid key and the username key in this collection, creating the indexes if necessary.

Types

type User

type User struct {
	Uuid     string `bson:"uuid" json:"uuid"`
	Username string `bson:"username" json:"username"`
	Fullname string `bson:"fullname" json:"fullname"`
	Email    string `bson:"email" json:"email"`
	Password string `bson:"password" json:"-"`
	Admin    bool   `bson:"shock_admin" json:"shock_admin"`
}

User struct

func FindByUsernamePassword

func FindByUsernamePassword(username string, password string) (u *User, err error)

func FindByUuid

func FindByUuid(uuid string) (u *User, err error)

func New

func New(username string, password string, isAdmin bool) (u *User, err error)

func (*User) Save

func (u *User) Save() (err error)

func (*User) SetMongoInfo added in v0.8.12

func (u *User) SetMongoInfo() (err error)

type Users

type Users []User

Array of User

Jump to

Keyboard shortcuts

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