Version: v0.0.0-...-cd1d72b Latest Latest

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

Go to latest
Published: Jul 24, 2016 License: MIT Imports: 5 Imported by: 0




View Source
const (
	// Active ...
	// flag : user is active
	Active = 1

	// InActive ...
	// flag : user is inactive
	InActive = 2


This section is empty.


This section is empty.


type Entity

type Entity struct {
	PostID       int64     `json:"post_id"            gorm:"column:post_id;primary_key"`
	Text         string    `json:"text"               gorm:"column:text"             sql:"not null;type:varchar(200)"`
	ActiveStatus int       `json:"active_status"      gorm:"column:active_status"    sql:"not null;type:tinyint(3)"`
	CreatedAt    time.Time `json:"created_at"         gorm:"column:created_at"       sql:"not null;type:datetime"`
	UpdatedAt    time.Time `json:"updated_at"         gorm:"column:updated_at"       sql:"not null;type:datetime"`

Entity describes user table.

func New

func New(text string) *Entity

New ...

func (*Entity) Primary

func (e *Entity) Primary() (interface{}, []interface{})

Primary returns

func (Entity) TableName

func (e Entity) TableName() string

TableName returns the table name

func (*Entity) Validate

func (e *Entity) Validate() error

Validate ...

type Repository

type Repository struct {

Repository ...

func NewRepository

func NewRepository(ctx *gin.Context) *Repository

NewRepository ...

func (*Repository) Create

func (r *Repository) Create(ent *Entity) (*Entity, error)

Create inserts the entity

func (*Repository) Find

func (r *Repository) Find() ([]Entity, error)

Find ...

func (*Repository) FindByIDs

func (r *Repository) FindByIDs(ids []int64) ([]Entity, error)

FindByIDs ...

func (*Repository) GetByID

func (r *Repository) GetByID(id int64) (*Entity, error)

GetByID ...

func (*Repository) Update

func (r *Repository) Update(ent *Entity) (*Entity, error)

Update ...

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL