dbutil

package
v0.9.3 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckNil

func CheckNil(v interface{}) bool

func FromDBMap

func FromDBMap(v DBMappable, m map[string]interface{})

func FromMap

func FromMap[PT MapConverterPtr[T], T any](m map[string]any) PT

func GetMapGen

func GetMapGen[PT MapConverterPtr[T], T any](tx *txwrap.TxWrap, query string, args ...interface{}) PT

func GetMappable

func GetMappable[PT DBMappablePtr[T], T any](tx *txwrap.TxWrap, query string, args ...interface{}) PT

func MakeGenMap

func MakeGenMap[T HasSimpleKey](arr []T) map[string]T

func MakeGenMapInt64

func MakeGenMapInt64[T HasSimpleInt64Key](arr []T) map[int64]T

func QuickJson

func QuickJson(v interface{}) string

func QuickJsonArr

func QuickJsonArr(v interface{}) string

func QuickJsonArrBytes

func QuickJsonArrBytes(v interface{}) []byte

func QuickJsonBytes

func QuickJsonBytes(v interface{}) []byte

func QuickNullableJson

func QuickNullableJson(v interface{}) string

func QuickScanJson

func QuickScanJson(ptr interface{}, val interface{}) error

func QuickSetBool

func QuickSetBool(bval *bool, m map[string]interface{}, name string)

func QuickSetBytes

func QuickSetBytes(bval *[]byte, m map[string]interface{}, name string)

func QuickSetInt

func QuickSetInt(ival *int, m map[string]interface{}, name string)

func QuickSetInt64

func QuickSetInt64(ival *int64, m map[string]interface{}, name string)

func QuickSetJson

func QuickSetJson(ptr interface{}, m map[string]interface{}, name string)

func QuickSetJsonArr

func QuickSetJsonArr(ptr interface{}, m map[string]interface{}, name string)

func QuickSetNullableInt64

func QuickSetNullableInt64(ival **int64, m map[string]any, name string)

func QuickSetNullableJson

func QuickSetNullableJson(ptr interface{}, m map[string]interface{}, name string)

func QuickSetStr

func QuickSetStr(strVal *string, m map[string]interface{}, name string)

func QuickValueJson

func QuickValueJson(v interface{}) (driver.Value, error)

func SelectMappable

func SelectMappable[PT DBMappablePtr[T], T any](tx *txwrap.TxWrap, query string, args ...interface{}) []PT

func SelectMapsGen

func SelectMapsGen[PT MapConverterPtr[T], T any](tx *txwrap.TxWrap, query string, args ...interface{}) []PT

func SelectSimpleMap

func SelectSimpleMap[T any](tx *txwrap.TxWrap, query string, args ...interface{}) map[string]T

func ToDBMap

func ToDBMap(v DBMappable, useBytes bool) map[string]interface{}

Types

type DBMappable

type DBMappable interface {
	UseDBMap()
}

type DBMappablePtr

type DBMappablePtr[T any] interface {
	DBMappable
	*T
}

type HasSimpleInt64Key

type HasSimpleInt64Key interface {
	GetSimpleKey() int64
}

type HasSimpleKey

type HasSimpleKey interface {
	GetSimpleKey() string
}

type MapConverter

type MapConverter interface {
	ToMap() map[string]interface{}
	FromMap(map[string]interface{}) bool
}

type MapConverterPtr

type MapConverterPtr[T any] interface {
	MapConverter
	*T
}

type MapEntry

type MapEntry[T any] struct {
	Key string
	Val T
}

Jump to

Keyboard shortcuts

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