models

package
v0.0.0-...-9f26130 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2019 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const Key = "fkzfgk0FY2CaYJhyXbshnPJaRrFtCwfj"

Key ...

Variables

This section is empty.

Functions

func CreateUser

func CreateUser(in *pb.CreateUserRequest, fieldResponses []*pb.CreateUserResponse_Field, db *gorm.DB) ([]*pb.CreateUserResponse_Field, error)

CreateUser ...

func Decrypt

func Decrypt(cryptoText string) string

Decrypt ...

func Encrypt

func Encrypt(text string) string

Encrypt ...

func SetupDatabase

func SetupDatabase(db *gorm.DB) error

SetupDatabase - Creates the tables in the database

Types

type Location

type Location struct {
	gorm.Model
	City    string `validate:"required"`
	Country string `validate:"required"`
	UserID  uint
}

Location ...

type User

type User struct {
	gorm.Model
	FirstName string `validate:"required"`
	LastName  string `validate:"required"`
	Email     string `gorm:"unique"`
	Password  string `validate:"required"`
	Age       int32  `validate:"required"`
	Role      string `validate:"required"`
	Location  Location
}

User ...

func (User) CreateInDB

func (user User) CreateInDB(ctx context.Context, in *pb.CreateUserRequest, db *gorm.DB) (*pb.CreateUserResponse, error)

CreateInDB ...

func (User) CreateSession

func (user User) CreateSession(sctx context.Context, in *pb.GetSessionRequest, db *gorm.DB) (*pb.GetSessionResponse, error)

CreateSession ...

Jump to

Keyboard shortcuts

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