pg

package
v0.0.51 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

* @Author: lisheng * @Date: 2022-10-18 15:04:49 * @LastEditTime: 2023-01-06 14:16:12 * @LastEditors: lisheng * @Description: PostareSQL驱动 * @FilePath: /jf-go-kit/database/pg/pg.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateDBEngnine

func CreateDBEngnine(user string, pwd string, addr string, port int, db string) *gorm.DB

*

  • @description: CreateDBEngnine
  • @param {string} user
  • @param {string} pwd
  • @param {string} addr
  • @param {int} port
  • @param {string} db
  • @return {*}
  • @author: liqiyuWorks

func DeleteRecordByCond

func DeleteRecordByCond(engineName string, tableName string, cond string, objPtr interface{}) (affectedRows int64, err error)

*

  • @description: D - Where 删除 根据条件查询
  • @param {string} tableName
  • @param {string} cond
  • @param {interface{}} objPtr
  • @return {*}
  • @author: liqiyuWorks

func FindRecordsByCond

func FindRecordsByCond(engineName string, tableName string, cond string, page int, pageSize int, resultSlicePtr interface{}) error

*

  • @description: R - Where 查询 根据条件查询
  • @param {string} tableName
  • @param {string} cond
  • @param {string} condValue
  • @param {int} page
  • @param {int} pageSize
  • @param {interface{}} resultSlicePtr
  • @return {*}
  • @author: liqiyuWorks

func InitPgManager

func InitPgManager() func() error

*

  • @description: 初始化PG
  • @return {*}
  • @author: liqiyuWorks

func InsertRecord

func InsertRecord(engineName string, tableName string, objPtr interface{}) (affectedRows int64, err error)

*

  • @description: C - 插入数据
  • @param {string} tableName
  • @param {string} cond
  • @param {interface{}} objPtr
  • @return {*}
  • @author: liqiyuWorks

func RegisterTable

func RegisterTable(engineName string, tableObj interface{})

*

  • @description: RegisterTable
  • @param {string} engineName
  • @param {interface{}} tableObj
  • @return {*}
  • @author: liqiyuWorks

func UpdateRecordByCond

func UpdateRecordByCond(engineName string, tableName string, cond string, fieldMap map[string]interface{}) (affectedRows int64, err error)

*

  • @description: U - Where 更新 根据条件查询
  • @param {string} tableName
  • @param {string} cond
  • @param {map[string]interface{}} fieldMap
  • @return {*}
  • @author: liqiyuWorks

Types

type PgManager

type PgManager struct {
	EngineMap map[string]*gorm.DB
}
var (
	GPgManager *PgManager = new(PgManager)
)

Jump to

Keyboard shortcuts

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