model

package
v0.0.0-...-bae350f Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AllRole = []Role{
	RoleAdmin,
	RoleUser,
}

Functions

This section is empty.

Types

type LogInInput

type LogInInput struct {
	Mobile   string `validate:"numeric,min=4" json:"mobile"`
	Password string `validate:"min=3,max=20" json:"password"`
}

type NewTodoInput

type NewTodoInput struct {
	Text string `json:"text"`
}

type NewUserInput

type NewUserInput struct {
	Name     string `json:"name"`
	Mobile   string `json:"mobile"`
	Password string `json:"password"`
}

type PagingInput

type PagingInput struct {
	Cursor *int64 `validate:"omitempty,gte=1,lte=9223372036854775807" json:"cursor"`
	After  int    `validate:"gte=1,lte=100" json:"after"`
}

type Role

type Role string
const (
	RoleAdmin Role = "ADMIN"
	RoleUser  Role = "USER"
)

func (Role) IsValid

func (e Role) IsValid() bool

func (Role) MarshalGQL

func (e Role) MarshalGQL(w io.Writer)

func (*Role) Scan

func (e *Role) Scan(v interface{}) error

func (Role) String

func (e Role) String() string

func (*Role) UnmarshalGQL

func (e *Role) UnmarshalGQL(v interface{}) error

func (Role) Value

func (e Role) Value() (driver.Value, error)

type Todo

type Todo struct {
	Id        int64     `xorm:"pk autoincr" json:"id"`
	Text      string    `xorm:"notnull text" json:"text"`
	AuthorId  int64     `xorm:"notnull index" json:"authorId"`
	CreatedAt time.Time `xorm:"notnull created" json:"createdAt"`
}

func (Todo) TableName

func (Todo) TableName() string

type UpdatePasswordInput

type UpdatePasswordInput struct {
	OldPassword string `json:"oldPassword"`
	NewPassword string `json:"newPassword"`
}

type UpdateTodoInput

type UpdateTodoInput struct {
	Text string `json:"text"`
}

type UpdateUserInput

type UpdateUserInput struct {
	Name   *string `json:"name"`
	Mobile *string `json:"mobile"`
}

type User

type User struct {
	Id        int64     `xorm:"pk autoincr" json:"id"`
	Name      string    `xorm:"varchar(10) notnull unique" json:"name"`
	Mobile    string    `xorm:"varchar(11) notnull unique" json:"mobile"`
	Password  string    `xorm:"text notnull" json:"-"`
	Role      Role      `xorm:"notnull" json:"role"`
	CreatedAt time.Time `xorm:"notnull created" json:"createdAt"`
}

func (User) TableName

func (User) TableName() string

Jump to

Keyboard shortcuts

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