writer

package
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: 10 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BoolFalse []byte = []byte("false")
View Source
var BoolTrue []byte = []byte("true")
View Source
var DoubleWriterNewDefault func(
	io.Writer,
) func(float64) IO[Void] = Curry[FloatWriterConfig[float64]](
	FloatNumberWriterNew,
)(
	FloatWriterConfig[float64]{
		Format:    'g',
		Precision: -1,
		BitSize:   64,
		ToDouble:  func(f float64) float64 { return f },
	},
)
View Source
var (
	ErrInvalidValue error = errors.New("invalid value")
)
View Source
var (
	ErrUnimplementedWriter error = errors.New("unimplemented writer")
)
View Source
var FloatWriterNewDefault func(
	io.Writer,
) func(float32) IO[Void] = Curry[FloatWriterConfig[float32]](
	FloatNumberWriterNew,
)(
	FloatWriterConfig[float32]{
		Format:    'g',
		Precision: -1,
		BitSize:   32,
		ToDouble:  func(f float32) float64 { return float64(f) },
	},
)
View Source
var IntWriterNew func(
	io.Writer,
) func(int32) IO[Void] = Curry[func(int32) int64](IntegerWriterNew)(
	func(i int32) int64 { return int64(i) },
)
View Source
var InvalidWtrRes IO[Void] = Err[Void](ErrUnimplementedWriter)
View Source
var LongWriterNew func(
	io.Writer,
) func(int64) IO[Void] = Curry[func(int64) int64](IntegerWriterNew)(
	func(i int64) int64 { return i },
)
View Source
var NullDoubleWriterNewDefault func(
	io.Writer,
) func(sql.Null[float64]) IO[Void] = Curry[FloatWriterConfig[float64]](
	NullFloatNumberWriterNew,
)(
	FloatWriterConfig[float64]{
		Format:    'g',
		Precision: -1,
		BitSize:   64,
		ToDouble:  func(f float64) float64 { return f },
	},
)
View Source
var NullFloatWriterNewDefault func(
	io.Writer,
) func(sql.Null[float32]) IO[Void] = Curry[FloatWriterConfig[float32]](
	NullFloatNumberWriterNew,
)(
	FloatWriterConfig[float32]{
		Format:    'g',
		Precision: -1,
		BitSize:   32,
		ToDouble:  func(f float32) float64 { return float64(f) },
	},
)
View Source
var NullIntWriterNew func(
	io.Writer,
) func(
	sql.Null[int32],
) IO[Void] = Curry[func(int32) int64](NullIntegerWriterNew)(
	func(i int32) int64 { return int64(i) },
)
View Source
var NullLongWriterNew func(
	io.Writer,
) func(
	sql.Null[int64],
) IO[Void] = Curry[func(int64) int64](NullIntegerWriterNew)(
	func(i int64) int64 { return i },
)

Functions

func BoolToBytes

func BoolToBytes(b bool) []byte

func BooleanWriterNew

func BooleanWriterNew(w io.Writer) func(bool) IO[Void]

func BytesWriterNew

func BytesWriterNew(w io.Writer) func([]byte) IO[Void]

func ConvertToNullable

func ConvertToNullable[T any](t *T) sql.Null[T]

func FloatNumberWriterNew

func FloatNumberWriterNew[T any](
	cfg FloatWriterConfig[T],
	w io.Writer,
) func(T) IO[Void]

func IntegerWriterNew

func IntegerWriterNew[T any](
	integer2long func(T) int64,
	w io.Writer,
) func(T) IO[Void]

func NullBooleanWriterNew

func NullBooleanWriterNew(w io.Writer) func(sql.Null[bool]) IO[Void]

func NullBytesWriterNew

func NullBytesWriterNew(w io.Writer) func(sql.Null[[]byte]) IO[Void]

func NullFloatNumberWriterNew

func NullFloatNumberWriterNew[T any](
	cfg FloatWriterConfig[T],
	w io.Writer,
) func(sql.Null[T]) IO[Void]

func NullIntegerWriterNew

func NullIntegerWriterNew[T any](
	integer2long func(T) int64,
	w io.Writer,
) func(sql.Null[T]) IO[Void]

func NullStringWriterNew

func NullStringWriterNew(w io.Writer) func(sql.Null[string]) IO[Void]

func NullTimeWriterNew

func NullTimeWriterNew(w io.Writer) func(sql.Null[time.Time]) IO[Void]

func NullUuidWriterNew

func NullUuidWriterNew(w io.Writer) func(sql.Null[uuid.UUID]) IO[Void]

func NullWriterNew

func NullWriterNew(w io.Writer) func(struct{}) IO[Void]

func StringWriterNew

func StringWriterNew(w io.Writer) func(string) IO[Void]

func TimeWriterNew

func TimeWriterNew(w io.Writer) func(time.Time) IO[Void]

func UuidWriterNew

func UuidWriterNew(w io.Writer) func(uuid.UUID) IO[Void]

Types

type AnyToValue

type AnyToValue func(any) Value

type FloatWriterConfig

type FloatWriterConfig[T any] struct {
	Format    byte
	Precision int
	BitSize   int
	ToDouble  func(T) float64
}

type NullableWriter

type NullableWriter struct {
	StringWriter  func(sql.Null[string]) IO[Void]
	BytesWriter   func(sql.Null[[]byte]) IO[Void]
	IntWriter     func(sql.Null[int32]) IO[Void]
	LongWriter    func(sql.Null[int64]) IO[Void]
	FloatWriter   func(sql.Null[float32]) IO[Void]
	DoubleWriter  func(sql.Null[float64]) IO[Void]
	BooleanWriter func(sql.Null[bool]) IO[Void]

	TimeWriter func(sql.Null[time.Time]) IO[Void]
	UuidWriter func(sql.Null[uuid.UUID]) IO[Void]
}
var NullableWriterDefault NullableWriter = NullableWriter{
	StringWriter:  func(_ sql.Null[string]) IO[Void] { return InvalidWtrRes },
	BytesWriter:   func(_ sql.Null[[]byte]) IO[Void] { return InvalidWtrRes },
	IntWriter:     func(_ sql.Null[int32]) IO[Void] { return InvalidWtrRes },
	LongWriter:    func(_ sql.Null[int64]) IO[Void] { return InvalidWtrRes },
	FloatWriter:   func(_ sql.Null[float32]) IO[Void] { return InvalidWtrRes },
	DoubleWriter:  func(_ sql.Null[float64]) IO[Void] { return InvalidWtrRes },
	BooleanWriter: func(_ sql.Null[bool]) IO[Void] { return InvalidWtrRes },

	TimeWriter: func(_ sql.Null[time.Time]) IO[Void] { return InvalidWtrRes },
	UuidWriter: func(_ sql.Null[uuid.UUID]) IO[Void] { return InvalidWtrRes },
}

func NullableWriterNew

func NullableWriterNew(w io.Writer) NullableWriter

type PrimitiveWriter

type PrimitiveWriter struct {
	StringWriter  func(string) IO[Void]
	BytesWriter   func([]byte) IO[Void]
	IntWriter     func(int32) IO[Void]
	LongWriter    func(int64) IO[Void]
	FloatWriter   func(float32) IO[Void]
	DoubleWriter  func(float64) IO[Void]
	BooleanWriter func(bool) IO[Void]
	NullWriter    func(struct{}) IO[Void]

	TimeWriter func(time.Time) IO[Void]
	UuidWriter func(uuid.UUID) IO[Void]
}
var PrimitiveWriterDefault PrimitiveWriter = PrimitiveWriter{
	StringWriter:  func(_ string) IO[Void] { return InvalidWtrRes },
	BytesWriter:   func(_ []byte) IO[Void] { return InvalidWtrRes },
	IntWriter:     func(_ int32) IO[Void] { return InvalidWtrRes },
	LongWriter:    func(_ int64) IO[Void] { return InvalidWtrRes },
	FloatWriter:   func(_ float32) IO[Void] { return InvalidWtrRes },
	DoubleWriter:  func(_ float64) IO[Void] { return InvalidWtrRes },
	BooleanWriter: func(_ bool) IO[Void] { return InvalidWtrRes },
	NullWriter:    func(_ struct{}) IO[Void] { return InvalidWtrRes },

	TimeWriter: func(_ time.Time) IO[Void] { return InvalidWtrRes },
	UuidWriter: func(_ uuid.UUID) IO[Void] { return InvalidWtrRes },
}

func PrimitiveWriterNew

func PrimitiveWriterNew(w io.Writer) PrimitiveWriter

type Value

type Value func(ValueWriter) IO[Void]

func AnyToVal

func AnyToVal(a any) Value

func BooleanToValue

func BooleanToValue(p bool) Value

func BytesToValue

func BytesToValue(p []byte) Value

func DoubleToValue

func DoubleToValue(p float64) Value

func FloatToValue

func FloatToValue(p float32) Value

func IntToValue

func IntToValue(p int32) Value

func InvalidValueFromErr

func InvalidValueFromErr(err error) Value

func LongToValue

func LongToValue(p int64) Value

func NullToValue

func NullToValue(p struct{}) Value

func NullableBooleanToValue

func NullableBooleanToValue(p sql.Null[bool]) Value

func NullableBytesToValue

func NullableBytesToValue(p sql.Null[[]byte]) Value

func NullableDoubleToValue

func NullableDoubleToValue(p sql.Null[float64]) Value

func NullableFloatToValue

func NullableFloatToValue(p sql.Null[float32]) Value

func NullableIntToValue

func NullableIntToValue(p sql.Null[int32]) Value

func NullableLongToValue

func NullableLongToValue(p sql.Null[int64]) Value

func NullableStringToValue

func NullableStringToValue(p sql.Null[string]) Value

func NullableTimeToValue

func NullableTimeToValue(p sql.Null[time.Time]) Value

func NullableUuidToValue

func NullableUuidToValue(p sql.Null[uuid.UUID]) Value

func StringToValue

func StringToValue(p string) Value

func TimeToValue

func TimeToValue(p time.Time) Value

func UuidToValue

func UuidToValue(p uuid.UUID) Value

Directories

Path Synopsis
internal
gen/a2vsw command
gen/any2val command

Jump to

Keyboard shortcuts

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