user

package
v0.0.0-...-55bb25f Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2018 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Addr = "user:9500"
)

Variables

View Source
var UserTable = &userTableType{
	s: parse.StructInfo{Type: "User", SQLSchema: "", SQLName: "user", Fields: []parse.FieldInfo{{Name: "ID", Type: "uint64", Column: "id"}, {Name: "Login", Type: "string", Column: "login"}, {Name: "PasswordHash", Type: "string", Column: "password"}}, PKFieldIndex: 0},
	z: new(User).Values(),
}

UserTable represents user view or table in SQL database.

Functions

This section is empty.

Types

type User

type User struct {
	ID           uint64 `reform:"id,pk" json:"id"`
	Login        string `reform:"login" json:"login"`
	Password     string `reform:"-" json:"password"`
	PasswordHash string `reform:"password" json:"-"`
}

User model

func Create

func Create(u *User) (*User, error)

Create is creating a new user

func GetByID

func GetByID(id uint64) (*User, error)

GetByID returns a user by ID or error

func GetByLogin

func GetByLogin(login string) (*User, error)

GetByLogin returns a user by login or error

func (*User) HasPK

func (s *User) HasPK() bool

HasPK returns true if record has non-zero primary key set, false otherwise.

func (User) MarshalEasyJSON

func (v User) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (User) MarshalJSON

func (v User) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*User) PKPointer

func (s *User) PKPointer() interface{}

PKPointer returns a pointer to primary key field for that record. Returned interface{} value is never untyped nil.

func (*User) PKValue

func (s *User) PKValue() interface{}

PKValue returns a value of primary key for that record. Returned interface{} value is never untyped nil.

func (*User) Pointers

func (s *User) Pointers() []interface{}

Pointers returns a slice of pointers to struct or record fields. Returned interface{} values are never untyped nils.

func (*User) SetPK

func (s *User) SetPK(pk interface{})

SetPK sets record primary key.

func (User) String

func (s User) String() string

String returns a string representation of this struct or record.

func (*User) Table

func (s *User) Table() reform.Table

Table returns Table object for that record.

func (*User) UnmarshalEasyJSON

func (v *User) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*User) UnmarshalJSON

func (v *User) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

func (*User) ValidateOnLogin

func (u *User) ValidateOnLogin() error

func (*User) ValidateOnRegistration

func (u *User) ValidateOnRegistration() error

func (*User) Values

func (s *User) Values() []interface{}

Values returns a slice of struct or record field values. Returned interface{} values are never untyped nils.

func (*User) View

func (s *User) View() reform.View

View returns View object for that struct.

Jump to

Keyboard shortcuts

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