gormplus

package
v0.0.0-...-831d175 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2019 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Debug        bool
	DBType       string
	DSN          string
	MaxLifetime  int
	MaxOpenConns int
	MaxIdleConns int
}

Config 配置参数

type DB

type DB struct {
	*gorm.DB
}

DB gorm扩展DB

func New

func New(c *Config) (*DB, error)

New 创建DB实例

func Wrap

func Wrap(db *gorm.DB) *DB

Wrap 包装gorm

func (*DB) Check

func (d *DB) Check(db *gorm.DB) (bool, error)

Check 检查数据是否存在

func (*DB) FindOne

func (d *DB) FindOne(db *gorm.DB, out interface{}) (bool, error)

FindOne 查询单条数据

func (*DB) FindPage

func (d *DB) FindPage(db *gorm.DB, pageIndex, pageSize int, out interface{}) (int, error)

FindPage 查询分页数据

Jump to

Keyboard shortcuts

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