models

package
v0.0.0-...-d94e6cf Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2016 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OpenDBWithConfig

func OpenDBWithConfig(config *config.Config) (dbConn gorm.DB, err error)

OpenDBWithConfig open a gorm.DB connection thanks to config.Database

Types

type Error

type Error struct {
	HTTPStatusCode int    `json:"status"`
	Message        string `json:"message"`
}

Error describes an error that occured in the API with a message and HTTP status code

func NewError

func NewError(statusCode int, err error) Error

NewError create a new Error struct that wrap error for JSON marshaling

type User

type User struct {
	ID        uint       `json:"id" gorm:"primary_key"`
	FirstName string     `json:"firstname" sql:"not null"`
	LastName  string     `json:"lastname" sql:"not null"`
	Email     string     `json:"email" sql:"not null;unique"`
	Password  string     `json:"-" sql:"not null"`
	CreatedAt time.Time  `json:"created_at"`
	UpdatedAt time.Time  `json:"updated_at"`
	DeletedAt *time.Time `json:"deleted_at" sql:"index"`
}

User holds user personal data

Jump to

Keyboard shortcuts

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