dao

package
v0.0.0-...-b11f01f Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2018 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DB *sql.DB

DB 全局的DB

View Source
var PurchaseInfoDao = &PurchaseInfoDAO{
	tableName: "purchase_info",
	cloumes:   "id, user, company, tel, purchase_num, purchase_time, created_time, updated_time",
}

Functions

func CloseDB

func CloseDB(db *sql.DB) (err error)

CloseDB 关闭数据库连接

func Init

func Init()

如果有框架的话,可以放在框架里面

func NewDB

func NewDB() (db *sql.DB)

NewDB 建立一个全局的db连接

Types

type PurchaseInfo

type PurchaseInfo struct {
	ID           int
	User         string
	Company      string
	Tel          string
	PurchaseNum  int
	PurchaseTime string
	CreatedTime  string
	UpdatedTime  string
}

PurchaseInfo 记录采购信息

type PurchaseInfoDAO

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

func (*PurchaseInfoDAO) Add

func (p *PurchaseInfoDAO) Add(r *PurchaseInfo) (err error)

func (*PurchaseInfoDAO) Count

func (p *PurchaseInfoDAO) Count() (total int64, err error)

func (*PurchaseInfoDAO) Get

func (p *PurchaseInfoDAO) Get(start, limit uint64) (res []*PurchaseInfo, err error)

func (*PurchaseInfoDAO) GetAll

func (p *PurchaseInfoDAO) GetAll(start, limit int64) (res []*PurchaseInfo, err error)

Jump to

Keyboard shortcuts

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