model

package
v0.0.0-...-b615adf Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2020 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Overview

数据库操作库

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ArcDB

type ArcDB struct {
	gorm.Model
	Catid   uint
	Title   string
	Context string
}

func (ArcDB) TableName

func (ArcDB) TableName() string

type ArcMDao

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

func (*ArcMDao) Add

func (a *ArcMDao) Add(catid uint, title string, context string) error

func (*ArcMDao) Del

func (a *ArcMDao) Del(id uint) error

func (*ArcMDao) FindAll

func (a *ArcMDao) FindAll() ([]ArcDB, error)

func (*ArcMDao) FindByCatID

func (a *ArcMDao) FindByCatID(catid uint) ([]ArcDB, error)

func (*ArcMDao) FindByID

func (a *ArcMDao) FindByID(id uint) (*ArcDB, error)

func (*ArcMDao) FindsByNum

func (a *ArcMDao) FindsByNum(num uint) ([]ArcDB, error)

func (*ArcMDao) UpdateCat

func (a *ArcMDao) UpdateCat(catID uint, mvCatId uint) error

type CatDB

type CatDB struct {
	gorm.Model
	Cname string
	Name  string
}

func (CatDB) TableName

func (CatDB) TableName() string

type CatMDao

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

func (*CatMDao) Add

func (c *CatMDao) Add(name string, cname string) error

func (*CatMDao) Del

func (c *CatMDao) Del(id uint) error

func (*CatMDao) FindAll

func (c *CatMDao) FindAll() ([]CatDB, error)

func (*CatMDao) FindByCName

func (c *CatMDao) FindByCName(name string) (*CatDB, error)

func (*CatMDao) Update

func (c *CatMDao) Update(id uint, name string, cname string) error

type Model

type Model struct {
	ArcDao *ArcMDao
	CatDao *CatMDao
	PagDao *PagMDao
	TweDao *TweMDao
	// contains filtered or unexported fields
}

func NewDatabase

func NewDatabase(url string, name string, password string, dbname string) (*Model, error)

创建一个新的数据库操作器

func (*Model) SetMaxIdleConns

func (m *Model) SetMaxIdleConns(n int)

func (*Model) SetMaxOpenConns

func (m *Model) SetMaxOpenConns(n int)

type PagMDao

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

func (*PagMDao) Add

func (p *PagMDao) Add(title string, context string) error

func (*PagMDao) Del

func (p *PagMDao) Del(id uint) error

func (*PagMDao) FindAll

func (p *PagMDao) FindAll() ([]PageDB, error)

func (*PagMDao) FindByID

func (p *PagMDao) FindByID(id uint) (*PageDB, error)

type PageDB

type PageDB struct {
	gorm.Model
	Title   string
	Context string
}

func (PageDB) TableName

func (PageDB) TableName() string

type TweMDao

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

func (*TweMDao) Add

func (t *TweMDao) Add(context string) error

func (*TweMDao) Count

func (t *TweMDao) Count() uint

func (*TweMDao) Del

func (t *TweMDao) Del(id uint) error

func (*TweMDao) FindByNum

func (t *TweMDao) FindByNum(page uint, num uint) ([]TweetDB, error)

type TweetDB

type TweetDB struct {
	gorm.Model
	Context string
}

func (TweetDB) TableName

func (TweetDB) TableName() string

Jump to

Keyboard shortcuts

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