user

package
v0.2.8 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2018 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type User

type User struct {
	// ID is uuid
	ID string `json:"id"`
	// Username username
	Username string `json:"username"`
	// Password password
	Password string `json:"-"`
	// Tokens tokens
	Tokens []string `json:"-"`
	// Joined joined
	Joined string `json:"joined"`
}

User is gost user

func NewUser

func NewUser(username, password string) *User

NewUser create a user with certain username and password

func (*User) AddToken

func (u *User) AddToken(token string) error

AddToken add a token to user

func (*User) Create

func (u *User) Create() error

Create store user to db

func (*User) GetUserByName

func (u *User) GetUserByName() error

GetUserByName can find a user by username

func (*User) New

func (u *User) New() *User

New fill the default fields

func (*User) Remove

func (u *User) Remove() error

Remove remove a user

func (*User) RemoveToken

func (u *User) RemoveToken(token string) error

RemoveToken remove a token from user

type UserModel

type UserModel interface {
	Create() error
	Remove() error
	AddToken(token string) error
	GetUserByName() error
}

UserModel is user model interface

Jump to

Keyboard shortcuts

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