models

package
v0.0.0-...-d204121 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2018 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BindJSON

func BindJSON(m interface{}, d map[string]interface{}) error

BindJSON map d to m

func Insert

func Insert(t DatabaseTable) error

Insert user

func ParseJSON

func ParseJSON(c echo.Context) (map[string]interface{}, error)

ParseJSON return map

func Select

func Select(t DatabaseTable, cond map[string]interface{}, cont echo.Context) error

Select return struct t

Types

type DatabaseTable

type DatabaseTable interface {
	TableName() string
	PrimaryKey() string
	ReflectType() reflect.Type
}

DatabaseTable shold has TableName, PrimaryKey, ReflectType

type User

type User struct {
	ID       int64  `json:"id" gorm:"primary_key"`
	Name     string `json:"name"`
	Password string `json:"password"`
	Hobby    string `json:"hobby"`
}

User struct has User table

func (User) PrimaryKey

func (User) PrimaryKey() string

PrimaryKey id

func (User) ReflectType

func (User) ReflectType() reflect.Type

ReflectType user

func (User) TableName

func (User) TableName() string

TableName usere

type Users

type Users []User

Users is multi user

func (Users) PrimaryKey

func (Users) PrimaryKey() string

PrimaryKey id

func (Users) ReflectType

func (Users) ReflectType() reflect.Type

ReflectType user

func (Users) TableName

func (Users) TableName() string

TableName user

Jump to

Keyboard shortcuts

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