database

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrDuplicate     = DuplicateError("duplicate")
	ErrNotFound      = NotFoundError("not found")
	ErrValidation    = ValidationError("validation")
	ErrBlockNotFound BlockNotFoundError
)

Functions

This section is empty.

Types

type BigInt

type BigInt struct {
	*big.Int
}

BigInt is a large integer data type that corresponds to a NUMERIC in a database.

func NewBigInt

func NewBigInt(bi *big.Int) *BigInt

func NewBigIntZero

func NewBigIntZero() *BigInt

func (*BigInt) Cmp

func (bi *BigInt) Cmp(a *BigInt) int

func (*BigInt) IsZero

func (bi *BigInt) IsZero() bool

func (BigInt) MarshalJSON

func (bi BigInt) MarshalJSON() ([]byte, error)

func (*BigInt) Scan

func (bi *BigInt) Scan(value interface{}) error

func (*BigInt) SetUint64

func (bi *BigInt) SetUint64(val uint64) *BigInt

func (*BigInt) UnmarshalJSON

func (bi *BigInt) UnmarshalJSON(data []byte) error

func (*BigInt) Value

func (bi *BigInt) Value() (driver.Value, error)

bi should not be a pointer but it seems like we are pleasing the Valuer interface. This needs some additional testing.

type BlockNotFoundError added in v0.6.0

type BlockNotFoundError struct {
	chainhash.Hash
}

func (BlockNotFoundError) Error added in v0.6.0

func (bnfe BlockNotFoundError) Error() string

func (BlockNotFoundError) Is added in v0.6.0

func (bnfe BlockNotFoundError) Is(target error) bool

type ByteArray

type ByteArray []byte

ByteArray is a type that corresponds to BYTEA in a database. It supports marshalling and unmarshalling from JSON, as well as implementing the sql.Scanner interface with NULL handling.

func (ByteArray) MarshalJSON

func (ba ByteArray) MarshalJSON() ([]byte, error)

func (*ByteArray) Scan

func (ba *ByteArray) Scan(value interface{}) error

func (ByteArray) String

func (ba ByteArray) String() string

func (*ByteArray) UnmarshalJSON

func (ba *ByteArray) UnmarshalJSON(data []byte) error

func (ByteArray) Value

func (ba ByteArray) Value() (driver.Value, error)

type Database

type Database interface {
	Close() error // Close database

	// SQL
	RegisterNotification(context.Context, NotificationName, NotificationCallback, any) error
	UnregisterNotification(NotificationName) error
}

type DuplicateError

type DuplicateError string

func (DuplicateError) Error

func (de DuplicateError) Error() string

func (DuplicateError) Is

func (de DuplicateError) Is(target error) bool

type NotFoundError

type NotFoundError string

func (NotFoundError) Error

func (nfe NotFoundError) Error() string

func (NotFoundError) Is

func (nfe NotFoundError) Is(target error) bool

type NotificationCallback

type NotificationCallback func(string, string, interface{}, interface{})

NotificationCallback is a callback function for a database notification.

type NotificationName

type NotificationName string

NotificationName identifies a database notification type.

type TimeZone

type TimeZone struct {
	// contains filtered or unexported fields
}

TimeZone is a type that encodes to and decodes from a +/-hh:mm string.

func (TimeZone) Equal

func (tz TimeZone) Equal(tzb TimeZone) bool

func (TimeZone) MarshalJSON

func (tz TimeZone) MarshalJSON() ([]byte, error)

func (*TimeZone) Parse

func (tz *TimeZone) Parse(s string) error

func (*TimeZone) Scan

func (tz *TimeZone) Scan(value interface{}) error

func (TimeZone) String

func (tz TimeZone) String() string

func (*TimeZone) UnmarshalJSON

func (tz *TimeZone) UnmarshalJSON(data []byte) error

func (TimeZone) Value

func (tz TimeZone) Value() (driver.Value, error)

type Timestamp

type Timestamp struct {
	time.Time
}

Timestamp is a type that corresponds to a TIMESTAMP in a database. It supports marshalling and unmarshalling from JSON, as well as implementing the sql.Scanner interface with NULL handling.

func NewTimestamp

func NewTimestamp(time time.Time) Timestamp

func (Timestamp) MarshalJSON

func (ts Timestamp) MarshalJSON() ([]byte, error)

func (*Timestamp) Scan

func (ts *Timestamp) Scan(value interface{}) error

func (*Timestamp) UnmarshalJSON

func (ts *Timestamp) UnmarshalJSON(data []byte) error

func (Timestamp) Value

func (ts Timestamp) Value() (driver.Value, error)

type ValidationError

type ValidationError string

func (ValidationError) Error

func (ve ValidationError) Error() string

func (ValidationError) Is

func (ve ValidationError) Is(target error) bool

type ZeroRowsError added in v0.1.1

type ZeroRowsError string

func (ZeroRowsError) Error added in v0.1.1

func (ze ZeroRowsError) Error() string

func (ZeroRowsError) Is added in v0.1.1

func (ze ZeroRowsError) Is(target error) bool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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