rowlike2sqlvals

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2024 License: Apache-2.0 Imports: 4 Imported by: 1

README

go-rowlike2sqlvalues

Rows(e.g, JSONs, PGCOPY) -> sql values(e.g, sql.Null[uuid.UUID])

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidType error = errors.New("invalid type")
)

Functions

func GetValueByKeyFromMap

func GetValueByKeyFromMap[K comparable, V any](
	onMissing func(K) error,
) func(map[K]V) func(K) (V, error)

Types

type PrimitiveType

type PrimitiveType string
const (
	PrimitiveUnknown PrimitiveType = "UNKNOWN"

	PrimitiveString  PrimitiveType = "string"
	PrimitiveBytes   PrimitiveType = "bytes"
	PrimitiveInt     PrimitiveType = "int"
	PrimitiveLong    PrimitiveType = "long"
	PrimitiveFloat   PrimitiveType = "float"
	PrimitiveDouble  PrimitiveType = "double"
	PrimitiveBoolean PrimitiveType = "boolean"
	PrimitiveNull    PrimitiveType = "null"

	PrimitiveTime PrimitiveType = "time"
	PrimitiveUuid PrimitiveType = "uuid"
)
const (
	NullString  PrimitiveType = "null-string"
	NullBytes   PrimitiveType = "null-bytes"
	NullInt     PrimitiveType = "null-int"
	NullLong    PrimitiveType = "null-long"
	NullFloat   PrimitiveType = "null-float"
	NullDouble  PrimitiveType = "null-double"
	NullBoolean PrimitiveType = "null-boolean"

	NullTime PrimitiveType = "null-time"
	NullUuid PrimitiveType = "null-uuid"
)

type StringToPrimitiveType

type StringToPrimitiveType func(string) (PrimitiveType, error)
var StringToType StringToPrimitiveType = GetValueByKeyFromMap[string, PrimitiveType](
	func(key string) error {
		return fmt.Errorf("%w: %s", ErrInvalidType, key)
	},
)(string2typMap)

Jump to

Keyboard shortcuts

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