pgs

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//ConnWrapperTypeID type id
	ConnWrapperTypeID = "ffc08507-dd5f-456c-84ea-cdae00b220bf"
)
View Source
const (
	//DaoBaseTypeID type id
	DaoBaseTypeID = "4d6adee7-7c10-4471-8885-a589688bac93"
)

Variables

This section is empty.

Functions

func CamelCased

func CamelCased(s string) string

CamelCased Just work for ASCⅡ code

func ConnWrapperTypeLives

func ConnWrapperTypeLives() []*dot.TypeLives

ConnWrapperTypeLives make all type lives

func CreateSchema

func CreateSchema(db *pg.DB, ms []interface{}) error

CreateSchema create tables

func DaoBaseTypeLives

func DaoBaseTypeLives() []*dot.TypeLives

DaoBaseTypeLives make all type lives

func SQLLikeEscape

func SQLLikeEscape(param string, special []rune, escape rune) string

SQLLikeEscape like escape

func SQLLikeEscapePostgres

func SQLLikeEscapePostgres(param string) string

SQLLikeEscapePostgres like escape

func ToExported

func ToExported(s string) string

ToExported Just work for ASCⅡ code

func ToFirstLower

func ToFirstLower(s string) string

ToFirstLower Lowercase for the first letter

func ToFirstUpper added in v0.2.1

func ToFirstUpper(s string) string

ToFirstUpper Uppercase for the first letter

func ToMap

func ToMap(d interface{}, ex map[string]bool) map[string]string

ToMap convert fields of struct to map, key is Lowercase for the first letter of the field name

func Underscore

func Underscore(s string) string

Underscore converts "CamelCasedString" to "camel_cased_string". Just work for ASCⅡ code

func UpperString

func UpperString(s string) string

UpperString Just work for ASCⅡ code

Types

type ConnWrapper

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

ConnWrapper connect wrapper

func GenerateConnWrapper

func GenerateConnWrapper(conf string) *ConnWrapper

GenerateConnWrapper this func is for test

func GenerateConnWrapperByDb

func GenerateConnWrapperByDb(db *pg.DB) *ConnWrapper

GenerateConnWrapperByDb this func is for test

func (*ConnWrapper) AfterAllDestroy

func (c *ConnWrapper) AfterAllDestroy(dot.Line)

func (*ConnWrapper) Create

func (c *ConnWrapper) Create(dot.Line) error

func (*ConnWrapper) GetDb

func (c *ConnWrapper) GetDb() *pg.DB

GetDb get db

func (*ConnWrapper) TestConn

func (c *ConnWrapper) TestConn() bool

TestConn test the connect

type DaoBase

type DaoBase struct {
	Wrapper *ConnWrapper `dot:""`
}

DaoBase doa base

func GenerateDaoBase

func GenerateDaoBase(conf string) *DaoBase

GenerateDaoBase this func is for test

func GenerateDaoBaseByDb

func GenerateDaoBaseByDb(db *pg.DB) *DaoBase

GenerateDaoBaseByDb this func is for test

func (*DaoBase) WithNoTx

func (c *DaoBase) WithNoTx(task func(conn orm.DB) error) error

WithNoTx no transaction

func (*DaoBase) WithTx

func (c *DaoBase) WithTx(task func(conn orm.DB) error) error

WithTx with transaction, if return err != nil then rollback, or commit the transaction

Jump to

Keyboard shortcuts

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