models

package
v0.0.0-...-77e484d Latest Latest
Warning

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

Go to latest
Published: May 6, 2019 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitValidator

func InitValidator() *validator.Validate

Types

type Login

type Login struct {
	Username string `validate:"required" json:"username"`
	Password string `validate:"required" json:"password"`
}

type Registration

type Registration struct {
	Username string `validate:"required" json:"username"`
	Email    string `json:"email"`
	Password string `validate:"required" json:"password"`
	Avatar   string `json:"avatar,omitempty"`
}

type Score

type Score struct {
	Score int `db:"score" json:"score"`
}

type Upgrade

type Upgrade struct {
	Id          int    `db:"uid" json:"id"`
	Name        string `db:"name" json:"name"`
	Cost        int    `db:"cost" json:"cost"`
	Type        int    `db:"type" json:"type"`
	Modificator int    `db:"modificator" json:"modificator"`
	Image       string `db:"image" json:"image"`
	Duration    int    `db:"time" json:"time"`
}

type User

type User struct {
	ID       int    `db:"uid" json:"id"`
	Username string `db:"username" json:"username" `
	Email    string `db:"email" json:"email"`
	Password string `db:"pass" json:"-"`
	Avatar   string `db:"avatar" json:"avatar,omitempty" `
	Score    int    `db:"score" json:"score"`
	Level    int    `db:"level" json:"level"`
}

func NewUser

func NewUser(username string, email string, password string) User

type UserUpdate

type UserUpdate struct {
	Email    string `json:"email,omitempty" validate:"email"`
	Password string `json:"password,omitempty" valid:"-"`
	Avatar   string `json:"avatar,omitempty" valid:"-"`
}

type Users

type Users []User

func (Users) Len

func (u Users) Len() int

func (Users) Less

func (u Users) Less(i, j int) bool

func (Users) Swap

func (u Users) Swap(i, j int)

Jump to

Keyboard shortcuts

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