Documentation ¶
Index ¶
- Variables
- func IsContainErrorDuplicateViolateUniqueConstraint(err error) bool
- func IsContainErrorNoRowsInResultSet(err error) bool
- func IsContainErrorTsquerySyntax(err error) bool
- func IsErrorDuplicateViolateUniqueConstraint(err error) bool
- func IsErrorNoRowsInResultSet(err error) bool
- func IsErrorTsquerySyntax(err error) bool
- func NamedGet(tx dbtypes.Named, dest interface{}, query string, arg interface{}) (err error)
- func NamedSelect(tx dbtypes.Named, dest interface{}, query string, arg interface{}) (err error)
- func SQLScanEnumString(obj interface{}, value interface{}, stringMapEnum map[string]interface{}) (err error)
- func SQLScanJson(obj interface{}, value interface{}) (err error)
- func SQLScanString(obj interface{}, value interface{}) (err error)
- func SQLScanStringSlice(obj interface{}, value interface{}) (err error)
- func SQLValueJson(obj interface{}) (value driver.Value, err error)
- func SQLValueStringSlice(obj interface{}) (value driver.Value, err error)
- func ToTsQuery(db *sqlx.DB, query string) (tsquery string, err error)
- type JsonText
- type SQLJsonMap
- type SQLStringSlice
Constants ¶
This section is empty.
Variables ¶
var ( ErrorUnsupportedScanType1 = errutil.NewFactory("unsupported scan type: %v") ErrorInvalidObjType1 = errutil.NewFactory("invalid obj type: %T") ErrorNoValueFound1 = errutil.NewFactory("no value found for key %v") )
var (
ErrorPrepareNamed = errutil.NewFactory("prepare SQL named query failed")
)
errors
Functions ¶
func IsErrorTsquerySyntax ¶
func NamedSelect ¶
NamedSelect prepare named SQL statement and call Select function
func SQLScanEnumString ¶
func SQLScanEnumString(obj interface{}, value interface{}, stringMapEnum map[string]interface{}) (err error)
Set obj to value's enum in stringMapEnum representation
func SQLScanJson ¶
func SQLScanJson(obj interface{}, value interface{}) (err error)
Set obj to value's JSON representation
func SQLScanString ¶
func SQLScanString(obj interface{}, value interface{}) (err error)
Set obj to value's string representation
func SQLScanStringSlice ¶
func SQLScanStringSlice(obj interface{}, value interface{}) (err error)
Set obj to value's stringslice representation
func SQLValueJson ¶
Return obj's JSON representation which implements driver.Value
func SQLValueStringSlice ¶
Return s postgresql representation which implements driver.Value
Types ¶
type JsonText ¶
type JsonText json.RawMessage
JsonText is a json.RawMessage, which is a []byte underneath. Value() validates the json format in the source, and returns an error if the json is not valid. Scan does no validation. JsonText additionally implements `Unmarshal`, which unmarshals the json within to an interface{}
func (*JsonText) MarshalJSON ¶
MarshalJSON returns the *j as the JSON encoding of j.
func (*JsonText) UnmarshalJSON ¶
UnmarshalJSON sets *j to a copy of data
type SQLJsonMap ¶
type SQLJsonMap map[string]interface{}
func (*SQLJsonMap) Scan ¶
func (t *SQLJsonMap) Scan(value interface{}) (err error)
type SQLStringSlice ¶
type SQLStringSlice []string
func NewSQLStringSlice ¶
func NewSQLStringSlice(s *[]string) *SQLStringSlice
func (*SQLStringSlice) Scan ¶
func (t *SQLStringSlice) Scan(value interface{}) (err error)
func (*SQLStringSlice) ToStringSlice ¶
func (t *SQLStringSlice) ToStringSlice() *[]string