types

package
v1.0.0-alpha.5 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2024 License: MIT Imports: 13 Imported by: 23

Documentation

Overview

The `types` package is reference from :

https://jackieli.dev/posts/pointers-in-go-used-in-sql-scanner/

This package is a helper library to prevent the value being fallback using reflection in `database/sql`.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BinaryMarshaler

func BinaryMarshaler[T interface {
	encoding.BinaryMarshaler
}](addr T) binaryMarshaler[T]

func BinaryUnmarshaler

func BinaryUnmarshaler[T any, Ptr interface {
	*T
	encoding.BinaryUnmarshaler
}](addr Ptr) binaryUnmarshaler[T, Ptr]

func Bool

func Bool[T ~bool](addr *T, strict ...bool) boolLike[T]

Bool returns a sql.Scanner

func BoolList

func BoolList[T ~bool](v *[]T) boolList[T]

func Date

func Date(addr *civil.Date, strict ...bool) localDate

Date returns a sql.Scanner

func Float

func Float[T constraints.Float](addr *T, strict ...bool) floatLike[T]

Float returns a sql.Scanner

func FloatList

func FloatList[T constraints.Float](v *[]T) floatList[T]

func IntList

func IntList[T constraints.Signed](v *[]T) intList[T]

func Integer

func Integer[T constraints.Integer](addr *T, strict ...bool) intLike[T]

func PtrOf

func PtrOf[T any](v T) *T

func PtrOfBool

func PtrOfBool[T ~bool](v **T) ptrOfBoolLike[T]

func PtrOfDate

func PtrOfDate(addr **civil.Date) ptrOfLocalDate

Date returns a sql.Scanner

func PtrOfFloat

func PtrOfFloat[T constraints.Float](v **T) ptrOfFloatLike[T]

func PtrOfInt

func PtrOfInt[T constraints.Integer](v **T) ptrOfIntLike[T]

func PtrOfString

func PtrOfString[T StringLikeType](v **T) ptrOfStrLike[T]

func PtrOfTime

func PtrOfTime[T time.Time](v **T) ptrOfTime[T]

func String

func String[T StringLikeType](addr *T, strict ...bool) strLike[T]

func StringList

func StringList[T ~string](v *[]T) strList[T]

func TextMarshaler

func TextMarshaler[T interface {
	encoding.TextMarshaler
}](addr T) textMarshaler[T]

func TextUnmarshaler

func TextUnmarshaler[T any, Ptr interface {
	*T
	encoding.TextUnmarshaler
}](addr Ptr) textUnmarshaler[T, Ptr]

func Time

func Time[T time.Time](addr *T, strict ...bool) datetime[T]

func UintList

func UintList[T constraints.Unsigned](v *[]T) uintList[T]

Types

type StringLikeType

type StringLikeType interface {
	~string | ~[]byte
}

Jump to

Keyboard shortcuts

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