models

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

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

Go to latest
Published: Mar 8, 2020 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountMap

type AccountMap map[string]interface{}

map

func (*AccountMap) Add

func (am *AccountMap) Add() error

func (*AccountMap) AddWithTransaction

func (am *AccountMap) AddWithTransaction(tx *gorm.DB) error

func (*AccountMap) Delete

func (am *AccountMap) Delete() error

func (*AccountMap) DeleteWithTransaction

func (am *AccountMap) DeleteWithTransaction(tx *gorm.DB) error

func (*AccountMap) List

func (am *AccountMap) List() error

func (*AccountMap) ListWithTransaction

func (am *AccountMap) ListWithTransaction(tx *gorm.DB) error

func (*AccountMap) Update

func (am *AccountMap) Update() error

func (*AccountMap) UpdateWithTransaction

func (am *AccountMap) UpdateWithTransaction(tx *gorm.DB) error

type Accounts

type Accounts struct {
	BaseModel

	UserName    string `json:"user_name" gorm:"type:varchar(255) column:user_name not null comment '用户名';"`
	FirstName   string `json:"first_name" gorm:"type:varchar(255) column:first_name comment '';"`
	LastName    string `json:"last_name" gorm:"type:varchar(255) column:last_name comment '';"`
	Gender      string `json:"gender" gorm:"type:varchar(255) column:gender comment '';"`
	Email       string `json:"email" gorm:"type:varchar(255) column:email comment '';"`
	IsActive    bool   `json:"is_active" gorm:"type:tinyint column:is_active comment ''"`
	Password    string `json:"password" gorm:"type:varchar(255) column:password"`
	Level       int    `json:"level" gorm:"type:int(3) column:level"`
	IsSuperUser bool   `json:"is_superuser" gorm:"type:tinyint column:is_superuser"`
}

func (*Accounts) Add

func (a *Accounts) Add() error

func (*Accounts) AddWithTransaction

func (a *Accounts) AddWithTransaction(tx *gorm.DB) error

func (*Accounts) Delete

func (a *Accounts) Delete() error

func (*Accounts) DeleteWithTransaction

func (a *Accounts) DeleteWithTransaction(tx *gorm.DB) error

func (*Accounts) List

func (a *Accounts) List() error

func (*Accounts) ListWithTransaction

func (a *Accounts) ListWithTransaction(tx *gorm.DB) error

func (*Accounts) Update

func (a *Accounts) Update() error

func (*Accounts) UpdateWithTransaction

func (a *Accounts) UpdateWithTransaction(tx *gorm.DB) error

type BaseModel

type BaseModel struct {
	Id        string     `json:"id" gorm:"primary_key column:id"`
	CreatedAt time.Time  `json:"created_at" gorm:"column:created_at"`
	UpdatedAt time.Time  `json:"updated_at" gorm:"column:updated_at"`
	DeletedAt *time.Time `json:"deleted_at" gorm:"column:deleted_at" sql:"index"`
}

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

func NewManager

func NewManager() *Manager

func (*Manager) Add

func (m *Manager) Add(ins ...Model) (int, error)

func (*Manager) Delete

func (m *Manager) Delete(ins ...Model) (int, error)

func (*Manager) GetBy

func (m *Manager) GetBy(ins Model, by map[string]interface{}) ([]Model, error)

func (*Manager) ListAll

func (m *Manager) ListAll(ins Model) ([]Model, error)

func (*Manager) Update

func (m *Manager) Update(ins ...Model) (int, error)

type Model

type Model interface {
	Add() error
	Update() error
	Delete() error
	List() error

	// with transaction
	AddWithTransaction(tx *gorm.DB) error
	DeleteWithTransaction(tx *gorm.DB) error
	UpdateWithTransaction(tx *gorm.DB) error
	ListWithTransaction(tx *gorm.DB) error
}

type Options

type Options interface {
	// contains filtered or unexported methods
}

Jump to

Keyboard shortcuts

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