dao

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: May 9, 2019 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DB *gorm.DB
)

global db or gorm db

Functions

func Close

func Close()

Close 关闭

func EscapeLike

func EscapeLike(colVal string) string

func Init

func Init()

func NewDB

func NewDB() *gorm.DB

func RollBackIfPanic

func RollBackIfPanic(db *gorm.DB)

Types

type CategoryDao

type CategoryDao struct {
	DB *gorm.DB
}

func (*CategoryDao) CreateCategory

func (dao *CategoryDao) CreateCategory(name string) *model.Category

func (*CategoryDao) FindAll

func (dao *CategoryDao) FindAll() []model.Category

func (*CategoryDao) Save

func (dao *CategoryDao) Save(name string) *model.Category

type FileDao

type FileDao struct {
	DB *gorm.DB
}

func (*FileDao) FindByCategoryID

func (dao *FileDao) FindByCategoryID(session *gorm.DB, categoryID uint) []model.File

func (*FileDao) FindByFuzz

func (dao *FileDao) FindByFuzz(f model.FileDTO) []model.FileDTO

func (*FileDao) FindByID

func (dao *FileDao) FindByID(id int) *model.File

func (*FileDao) FindByMD5

func (dao *FileDao) FindByMD5(md5 string) *model.File

func (*FileDao) FindByName

func (dao *FileDao) FindByName(name string) *model.File

func (*FileDao) Save

func (dao *FileDao) Save(file *model.File)

Jump to

Keyboard shortcuts

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