nullable

package module
v2.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2024 License: MIT Imports: 9 Imported by: 0

README

nullable

Go Reference test Go Report Card

Installation

go get github.com/m0t0k1ch1-go/nullable/v2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bool

type Bool struct {
	sql.NullBool
}

Bool is a nullable bool.

func NewBool

func NewBool(b bool, valid bool) Bool

NewBool returns a new Bool.

func NewBoolFromBoolPtr added in v2.2.0

func NewBoolFromBoolPtr(b *bool) Bool

NewBoolFromBoolPtr returns a new Bool from a bool pointer.

func (Bool) BoolPtr added in v2.2.0

func (n Bool) BoolPtr() *bool

BoolPtr returns the bool pointer.

func (Bool) MarshalJSON

func (n Bool) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface.

func (*Bool) UnmarshalJSON

func (n *Bool) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

type EthAddress

type EthAddress struct {
	EthAddress ethcommon.Address
	Valid      bool
}

EthAddress is a nullable github.com/ethereum/go-ethereum/common.Address.

func NewEthAddress

func NewEthAddress(address ethcommon.Address, valid bool) EthAddress

NewEthAddress returns a new EthAddress.

func (EthAddress) MarshalJSON

func (n EthAddress) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface.

func (EthAddress) NullableString

func (n EthAddress) NullableString() String

NullableString returns the String.

func (*EthAddress) Scan

func (n *EthAddress) Scan(src any) error

Scan implements the sql.Scanner interface.

func (*EthAddress) UnmarshalJSON

func (n *EthAddress) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

func (EthAddress) Value

func (n EthAddress) Value() (driver.Value, error)

Value implements the driver.Valuer interface.

type EthHash

type EthHash struct {
	EthHash ethcommon.Hash
	Valid   bool
}

EthHash is a nullable github.com/ethereum/go-ethereum/common.Hash.

func NewEthHash

func NewEthHash(h ethcommon.Hash, valid bool) EthHash

NewEthHash returns a new EthHash.

func (EthHash) MarshalJSON

func (n EthHash) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface.

func (EthHash) NullableString

func (n EthHash) NullableString() String

NullableString returns the String.

func (*EthHash) Scan

func (n *EthHash) Scan(src any) error

Scan implements the sql.Scanner interface.

func (*EthHash) UnmarshalJSON

func (n *EthHash) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

func (EthHash) Value

func (n EthHash) Value() (driver.Value, error)

Value implements the driver.Valuer interface.

type Int32

type Int32 struct {
	sql.NullInt32
}

Int32 is a nullable int32.

func NewInt32

func NewInt32(i int32, valid bool) Int32

NewInt32 returns a new Int32.

func NewInt32FromInt32Ptr added in v2.2.0

func NewInt32FromInt32Ptr(i *int32) Int32

NewInt32FromInt32Ptr returns a new Int32 from a int32 pointer.

func (Int32) Int32Ptr added in v2.2.0

func (n Int32) Int32Ptr() *int32

Int32Ptr returns the int32 pointer.

func (Int32) MarshalJSON

func (n Int32) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface.

func (*Int32) UnmarshalJSON

func (n *Int32) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

type Int64

type Int64 struct {
	sql.NullInt64
}

Int64 is a nullable int64.

func NewInt64

func NewInt64(i int64, valid bool) Int64

NewInt64 returns a new Int64.

func NewInt64FromInt64Ptr added in v2.2.0

func NewInt64FromInt64Ptr(i *int64) Int64

NewInt64FromInt64Ptr returns a new Int64 from a int64 pointer.

func (Int64) Int64Ptr added in v2.2.0

func (n Int64) Int64Ptr() *int64

Int64Ptr returns the int64 pointer.

func (Int64) MarshalJSON

func (n Int64) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface.

func (*Int64) UnmarshalJSON

func (n *Int64) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

type String

type String struct {
	sql.NullString
}

String is a nullable string.

func NewString

func NewString(s string, valid bool) String

NewString returns a new String.

func NewStringFromStringPtr added in v2.2.0

func NewStringFromStringPtr(s *string) String

NewStringFromStringPtr returns a new String from a string pointer.

func (String) MarshalJSON

func (n String) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface.

func (String) MarshalYAML

func (n String) MarshalYAML() (any, error)

MarshalYAML implements the yaml.Marshaler interface.

func (String) StringPtr added in v2.2.0

func (n String) StringPtr() *string

StringPtr returns the string pointer.

func (*String) UnmarshalJSON

func (n *String) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

func (*String) UnmarshalYAML

func (n *String) UnmarshalYAML(unmarshal func(any) error) error

UnmarshalYAML implements the yaml.Unmarshaler interface.

type Timestamp

type Timestamp struct {
	Timestamp timeutil.Timestamp
	Valid     bool
}

Timestamp is a nullable github.com/m0t0k1ch1-go/timeutil.Timestamp.

func NewTimestamp

func NewTimestamp(ts timeutil.Timestamp, valid bool) Timestamp

NewTimestamp returns a new Timestamp.

func (Timestamp) MarshalJSON

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

MarshalJSON implements the json.Marshaler interface.

func (Timestamp) NullableString

func (n Timestamp) NullableString() String

NullableString returns the String.

func (*Timestamp) Scan

func (n *Timestamp) Scan(src any) error

Scan implements the sql.Scanner interface.

func (*Timestamp) UnmarshalJSON

func (n *Timestamp) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

func (Timestamp) Value

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

Value implements the driver.Valuer interface.

type Uint256

type Uint256 struct {
	Uint256 bigutil.Uint256
	Valid   bool
}

Uint256 is a nullable github.com/m0t0k1ch1-go/bigutil.Uint256.

func NewUint256

func NewUint256(i bigutil.Uint256, valid bool) Uint256

NewUint256 returns a new Uint256.

func (Uint256) MarshalJSON

func (n Uint256) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface.

func (Uint256) NullableString

func (n Uint256) NullableString() String

NullableString returns the String.

func (*Uint256) Scan

func (n *Uint256) Scan(src any) error

Scan implements the sql.Scanner interface.

func (*Uint256) UnmarshalJSON

func (n *Uint256) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

func (Uint256) Value

func (n Uint256) Value() (driver.Value, error)

Value implements the driver.Valuer interface.

type Uint64

type Uint64 struct {
	Uint64 uint64
	Valid  bool
}

Uint64 is a nullable uint64.

func NewUint64

func NewUint64(i uint64, valid bool) Uint64

NewUint64 returns a new Uint64.

func NewUint64FromUint64Ptr added in v2.2.0

func NewUint64FromUint64Ptr(i *uint64) Uint64

NewUint64FromUint64Ptr returns a new Uint64 from a uint64 pointer.

func (Uint64) MarshalJSON

func (n Uint64) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface.

func (*Uint64) Scan

func (n *Uint64) Scan(src any) error

Scan implements the sql.Scanner interface.

func (Uint64) Uint64Ptr added in v2.2.0

func (n Uint64) Uint64Ptr() *uint64

Uint64Ptr returns the uint64 pointer.

func (*Uint64) UnmarshalJSON

func (n *Uint64) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

func (Uint64) Value

func (n Uint64) Value() (driver.Value, error)

Value implements the driver.Valuer interface.

Jump to

Keyboard shortcuts

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