dbutil

package
v0.14.2-beta.1 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2026 License: Apache-2.0 Imports: 7 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckNil

func CheckNil(v any) 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 ParseJsonArr added in v0.11.1

func ParseJsonArr[T any](val string) []T

func ParseJsonMap added in v0.11.1

func ParseJsonMap(val string, forceMake bool) map[string]any

on error will return nil unless forceMake is set, in which case it returns make(map[string]any)

func QuickJson

func QuickJson(v any) string

func QuickJsonArr

func QuickJsonArr(v any) string

func QuickJsonArrBytes

func QuickJsonArrBytes(v any) []byte

func QuickJsonBytes

func QuickJsonBytes(v any) []byte

func QuickNullableJson

func QuickNullableJson(v any) string

func QuickScanJson

func QuickScanJson(ptr any, val any) error

func QuickSetBool

func QuickSetBool(bval *bool, m map[string]any, name string)

func QuickSetBytes

func QuickSetBytes(bval *[]byte, m map[string]any, name string)

func QuickSetInt

func QuickSetInt(ival *int, m map[string]any, name string)

func QuickSetInt64

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

func QuickSetJson

func QuickSetJson(ptr any, m map[string]any, name string)

func QuickSetJsonArr

func QuickSetJsonArr(ptr any, m map[string]any, name string)

func QuickSetNullableInt64

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

func QuickSetNullableJson

func QuickSetNullableJson(ptr any, m map[string]any, name string)

func QuickSetStr

func QuickSetStr(strVal *string, m map[string]any, name string)

func QuickValueJson

func QuickValueJson(v any) (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