database

package
v0.15.2 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2024 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Overview

* @Author: kamalyes 501893067@qq.com * @Date: 2023-07-28 00:50:58 * @LastEditors: kamalyes 501893067@qq.com * @LastEditTime: 2024-11-03 20:02:19 * @FilePath: \go-core\pkg\database\client.go * @Description: * * Copyright (c) 2024 by kamalyes, All Rights Reserved.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CamelToCase

func CamelToCase(name string) string

func CheckPageRows

func CheckPageRows(currentStr, rowCountStr string) (current, rowCount int)

CheckPageRows 获取页数和行数

func Gorm

func Gorm() *gorm.DB

Gorm 初始化数据库并产生数据库全局变量

func GormMySQL

func GormMySQL() *gorm.DB

GormMySQL 初始化MySQL数据库

func GormPostgreSQL

func GormPostgreSQL() *gorm.DB

GormPostgreSQL 初始化PostgreSQL数据库

func GormSQLite

func GormSQLite() *gorm.DB

GormSQLite 连接SQLite数据库

Types

type Buffer

type Buffer struct {
	*bytes.Buffer
}

Buffer 内嵌bytes.Buffer,支持连写

func NewBuffer

func NewBuffer() *Buffer

func (*Buffer) Append

func (b *Buffer) Append(i interface{}) *Buffer

type PageBean

type PageBean struct {

	/** 当前页  */
	Page int `json:"page"`

	/** 当前页的行数 */
	PageSize int `json:"pageSize"`

	/** 总记录数 */
	Total int64 `json:"total"`

	/** 每行的数据 */
	Rows interface{} `json:"rows"`
}

PageBean 全局分页对象

func FindPage

func FindPage(v interface{}, rows interface{}, pageInfo *PageInfo) (err error, pageBean *PageBean)

FindPage 分页查询 v-空对象指针

type PageInfo

type PageInfo struct {

	/** 当前页 */
	Current int

	/** 每页显示的最大行数 */
	RowCount int

	/** 表名 仅限于指定表名去查询 */
	TableName string

	/** 查询 and 条件参数 */
	AndParams map[string]interface{}

	/** 查询 or 条件参数 */
	OrParams map[string]interface{}

	/** 排序 */
	OrderStr string
}

func PageParam

func PageParam(c *gin.Context) *PageInfo

PageParam 获取url查询参数

Jump to

Keyboard shortcuts

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