models

package
v0.0.0-...-cec3f95 Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2017 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewUserProto

func NewUserProto(user *User) (*pb.User, error)

func SetIdGenerator

func SetIdGenerator(generator duid.IdGenerator)

Types

type BaseModel

type BaseModel struct {
	ID        uint       `sql:"type: bigint PRIMARY KEY" json:"id,string"`
	CreatedAt time.Time  `json:"createdAt"`
	UpdatedAt time.Time  `json:"updatedAt"`
	DeletedAt *time.Time `json:"deletedAt,omitempty"`
}

type User

type User struct {
	BaseModel
	Age   int    `json:"age"`
	Name  string `gorm:"type:varchar(100)" json:"name"`
	Email string `gorm:"type:varchar(100);unique_index" json:"email"`
}

func NewUser

func NewUser(name, email string, age int) *User

func NewUserModel

func NewUserModel(user *pb.User) (*User, error)

func (*User) BeforeDelete

func (user *User) BeforeDelete(scope *gorm.Scope) error

Jump to

Keyboard shortcuts

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