models

package
v0.0.0-...-4b40179 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2016 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Db *gorm.DB

Functions

func GetDb

func GetDb() *gorm.DB

func InitDb

func InitDb(db_url, dialect string) *gorm.DB

func InitTables

func InitTables(db_url, db_dialect string)

func SetDb

func SetDb(db *gorm.DB)

Types

type Model

type Model struct {
	ID        string `gorm:"primary_key"`
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt *time.Time
}

func (*Model) BeforeCreate

func (model *Model) BeforeCreate()

type User

type User struct {
	Model
	Username    string
	Password    string
	Phonenumber string
	Email       string
}

func GetSessionUser

func GetSessionUser(session *sessions.Session) *User

func NewUser

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

func (*User) Get

func (user *User) Get(id string) *User

func (*User) Save

func (user *User) Save()

Jump to

Keyboard shortcuts

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