model

package
v0.0.0-...-e82c7fc Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2020 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Message

type Message struct {
	ID     int    `json:"id" gorm:"not null;primary"`
	FromID int    `json:"from"`
	ToID   int    `json:"to"`
	Time   int64  `json:"time"`
	Body   string `json:"body"`
	Token  string `json:"token,omitempty" sql:"-"`
}

Message is a struct of message

type Profile

type Profile struct {
	FirstName string `json:"first_name"`
	LastName  string `json:"last_name"`
	UserID    int    `json:"user_id" gorm:"association_foreignkey:id"`
	UserEmail string `json:"user_email"`
	About     string `json:"about,omitempty"`
}

Profile of user

type User

type User struct {
	ID                int    `json:"id" gorm:"not null;primary key;unique"`
	Password          string `sql:"-" json:"-"`
	UserName          string `json:"user_name" sql:"user_name" gorm:"not null;unique"`
	Email             string `gorm:"not null;unique" json:"email,omitempty"`
	EncryptedPassword string `json:"encrypted_password,omitempty"`
	JwtToken          string `sql:"jwt_token" json:"-"`
}

User a struct of user info

func TestUser

func TestUser(t *testing.T) *User

TestUser ...

func (*User) BeforeCreate

func (u *User) BeforeCreate() error

BeforeCreate a func for create hashed passw

func (*User) ComparePassword

func (u *User) ComparePassword(password string) bool

ComparePassword ...

func (*User) Sanitize

func (u *User) Sanitize()

Sanitize make passw empty

func (*User) Validate

func (u *User) Validate() error

Validate a validate of user

Jump to

Keyboard shortcuts

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