mysql

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Controller

type Controller interface {
	Model() interface{}
	SetModel(interface{}) Controller
	Filter(filter map[string]interface{}) Controller
	OrderBy(orderBy string) Controller
	Limit(pageSize, pageNum int) Controller
	Count() (int64, error)
	Exist() (bool, error)
	Get() (interface{}, error)
	All() ([]interface{}, error)
	List() (int64, []map[string]interface{}, error)
	Create(map[string]interface{}) error
	Update(map[string]interface{}, []string, []string) error
	Delete(map[string]interface{}) error
	CreateIfNotExist(map[string]interface{}, []string) error
	CreateOrUpdate(map[string]interface{}, []string, []string) (interface{}, bool, error)
	CreateOrUpdateByModel([]string, []string) (interface{}, bool, error)
	GetC2CMap(string, string) (map[string]string, error)
	GetKey2IDMap(string) (map[string]int64, error)
	GetID2KeyMap(string) (map[int64]string, error)
	GetID2Map() (map[int64]map[string]interface{}, error)
}

func NewCtl

func NewCtl(model interface{}) Controller

type Impl

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

func (Impl) All

func (i Impl) All() (res []interface{}, err error)

func (Impl) Count

func (i Impl) Count() (int64, error)

func (Impl) Create

func (i Impl) Create(data map[string]interface{}) (err error)

func (Impl) CreateIfNotExist

func (i Impl) CreateIfNotExist(
	data map[string]interface{},
	primaryKeys []string,
) (err error)

func (Impl) CreateOrUpdate

func (i Impl) CreateOrUpdate(
	data map[string]interface{}, primaryKeys []string, updateFields []string,
) (obj interface{}, created bool, err error)

func (Impl) CreateOrUpdateByModel

func (i Impl) CreateOrUpdateByModel(
	primaryKeys []string, updateFields []string,
) (obj interface{}, created bool, err error)

func (Impl) Delete

func (i Impl) Delete(data map[string]interface{}) (err error)

func (Impl) Exist

func (i Impl) Exist() (bool, error)

func (Impl) Filter

func (i Impl) Filter(filter map[string]interface{}) Controller

func (Impl) Get

func (i Impl) Get() (interface{}, error)

func (Impl) GetC2CMap

func (i Impl) GetC2CMap(column1, column2 string) (res map[string]string, err error)

func (Impl) GetID2KeyMap

func (i Impl) GetID2KeyMap(key string) (res map[int64]string, err error)

func (Impl) GetID2Map

func (i Impl) GetID2Map() (res map[int64]map[string]interface{}, err error)

func (Impl) GetKey2IDMap

func (i Impl) GetKey2IDMap(key string) (res map[string]int64, err error)

func (Impl) Limit

func (i Impl) Limit(pageSize, pageNum int) Controller

func (Impl) List

func (i Impl) List() (total int64, res []map[string]interface{}, err error)

func (Impl) Model

func (i Impl) Model() interface{}

func (Impl) OrderBy

func (i Impl) OrderBy(orderBy string) Controller

func (Impl) SetModel

func (i Impl) SetModel(model interface{}) Controller

func (Impl) Update

func (i Impl) Update(
	data map[string]interface{},
	primaryKeys []string,
	updateFields []string,
) (err error)

Jump to

Keyboard shortcuts

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