types

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Binary added in v0.9.3

type Binary[T Serializable[T]] struct {
	Data T
}

Binary[T] is a []byte which transparently Binary[T] data being submitted to a database and unmarshal data being Scanned from a database.

func (*Binary[T]) Scan added in v0.9.3

func (b *Binary[T]) Scan(src any) (err error)

Scan implements the sql.Scanner interface, unmashal the value coming off the wire and storing the raw result in the Binary[T].

func (*Binary[T]) Value added in v0.9.3

func (b *Binary[T]) Value() (driver.Value, error)

Value implements the driver.Valuer interface, marshal the raw value of this Binary[T].

type Empty

type Empty = struct{}

Empty empty alias type

type Fn

type Fn = func()

Fn empty argument func alias type

type NullBinary added in v0.9.3

type NullBinary[T Serializable[T]] struct {
	Data  T
	Valid bool // Valid is true if Binary is not NULL
}

NullBinary[T] represents a Binary that may be null. NullBinary[T] implements the scanner interface so it can be used as a scan destination, similar to NullString.

func (*NullBinary[T]) Scan added in v0.9.3

func (b *NullBinary[T]) Scan(src any) (err error)

Scan implements the sql.Scanner interface, unmashal the value coming off the wire and storing the raw result in the Binary[T].

func (*NullBinary[T]) Value added in v0.9.3

func (b *NullBinary[T]) Value() (driver.Value, error)

Value implements the driver.Valuer interface, marshal the raw value of this Binary[T].

type Serializable added in v0.9.3

type Serializable[T any] interface {
	MarshalBinary() ([]byte, error)
	UnmarshalBinary(data []byte) (T, error)
}

Serializable data marshal/unmarshal constraint for Binary type.

type Set

type Set[T comparable] map[T]struct{}

Set[T] a simple set alias to map

Jump to

Keyboard shortcuts

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