orm

package
v0.0.0-...-df740be Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2022 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package orm orm Author: Frank Lee Date: 2017-08-01 19:53:05 Last Modified by: Frank Lee Last Modified time: 2018-04-29 22:54

Package orm orm Author: Frank Lee Date: 2017-08-01 19:53:21 Last Modified by: Frank Lee Last Modified time: 2018-04-29 22:54

Package orm orm Author: Frank Lee Date: 2017-08-01 20:02:22 Last Modified by: Frank Lee Last Modified time: 2018-04-29 22:54

Package orm orm Author: Frank Lee Date: 2017-06-01 20:02:27 Last Modified by: Frank Lee Last Modified time: 2018-04-09 22:28:27

Package orm orm Author: Frank Lee Date: 2017-08-01 19:53:05 Last Modified by: Frank Lee Last Modified time: 2018-04-29 22:54

Package orm orm Author: Frank Lee Date: 2017-08-01 20:02:41 Last Modified by: Frank Lee Last Modified time: 2018-04-29 22:54

Package orm orm Author: Frank Lee Date: 2017-08-01 20:02:45 Last Modified by: Frank Lee Last Modified time: 2018-04-29 22:54

Package orm orm Author: Frank Lee Date: 2017-08-01 20:02:48 Last Modified by: Frank Lee Last Modified time: 2018-04-29 22:54

Index

Constants

This section is empty.

Variables

View Source
var (

	// SHOWSQL whether or not show sql
	SHOWSQL = false
)

Functions

func InitGQL

func InitGQL() *gql

InitGQL return a pointer to new gql

func RegisterDataSource

func RegisterDataSource(name, s string, o *Option) error

RegisterDataSource register data source Option is optional name name of data source s uri

Types

type DunplicateDataSourceErr

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

DunplicateDataSourceErr dunplicate data source

func (*DunplicateDataSourceErr) Error

func (err *DunplicateDataSourceErr) Error() string

type DunplicateSQLIDErr

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

DunplicateSQLIDErr dunplicate sql id

func (*DunplicateSQLIDErr) Error

func (err *DunplicateSQLIDErr) Error() string

type M

type M map[string]interface{}

M map of paramaters. Use it if parameter is not a struct

func AsM

func AsM(a interface{}, params []string) M

AsM cast struct to M using params

type NoFieldNeedUpdateErr

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

NoFieldNeedUpdateErr no field need to be update in update set clause

func (*NoFieldNeedUpdateErr) Error

func (err *NoFieldNeedUpdateErr) Error() string

type NotSliceInRangeErr

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

NotSliceInRangeErr empty slice in range

func (*NotSliceInRangeErr) Error

func (err *NotSliceInRangeErr) Error() string

type NotStructErr

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

NotStructErr not a struct

func (*NotStructErr) Error

func (err *NotStructErr) Error() string

type Option

type Option struct {
	MaxOpenedConnection int // max open conn
	MaxIdleConnection   int
	MaxLifeTime         int // minutes
}

Option option

type ParamNotFoundErr

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

ParamNotFoundErr params not found in M

func (*ParamNotFoundErr) Error

func (err *ParamNotFoundErr) Error() string

type PointerParamErr

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

PointerParamErr ResultSet receiver must be a pointer

func (*PointerParamErr) Error

func (err *PointerParamErr) Error() string

type SQLMatchErr

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

SQLMatchErr no sql matches sqlID

func (*SQLMatchErr) Error

func (err *SQLMatchErr) Error() string

type Transaction

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

Transaction transaction

func InitTran

func InitTran(dataSource string) *Transaction

InitTran init transaction

func (*Transaction) All

func (tran *Transaction) All(sqlID string, params M, result interface{}, tableNames map[string]string) (int64, error)

All select many

func (*Transaction) Commit

func (tran *Transaction) Commit() error

Commit commit transaction

func (*Transaction) Delete

func (tran *Transaction) Delete(sqlID string, params M, result interface{}, tableNames map[string]string) (int64, error)

Delete delete

func (*Transaction) Error

func (tran *Transaction) Error() error

Error return the first error in db transaction

func (*Transaction) Insert

func (tran *Transaction) Insert(sqlID string, params M, result interface{}, tableNames map[string]string) (int64, error)

Insert insert

func (*Transaction) One

func (tran *Transaction) One(sqlID string, params M, result interface{}, tableNames map[string]string) (int64, error)

One select one

func (*Transaction) ShowSQL

func (tran *Transaction) ShowSQL(b bool) *Transaction

ShowSQL show sql

func (*Transaction) Update

func (tran *Transaction) Update(sqlID string, params M, result interface{}, tableNames map[string]string) (int64, error)

Update update

type UnknownDataSourceErr

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

UnknownDataSourceErr unknown data source

func (*UnknownDataSourceErr) Error

func (err *UnknownDataSourceErr) Error() string

Jump to

Keyboard shortcuts

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