types

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: GPL-2.0 Imports: 14 Imported by: 2

Documentation

Index

Constants

View Source
const (
	StateSoft = StateType(0)
	StateHard = StateType(1)
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AcknowledgementState

type AcknowledgementState uint8

AcknowledgementState specifies an acknowledgement state (yes, no, sticky).

func (*AcknowledgementState) UnmarshalJSON

func (as *AcknowledgementState) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

func (*AcknowledgementState) UnmarshalText

func (as *AcknowledgementState) UnmarshalText(text []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface.

func (AcknowledgementState) Value

func (as AcknowledgementState) Value() (driver.Value, error)

Value implements the driver.Valuer interface.

type Binary

type Binary []byte

Binary nullable byte string. Hex as JSON.

func (Binary) Equal

func (binary Binary) Equal(equaler contracts.Equaler) bool

Equal returns whether the binaries are the same length and contain the same bytes.

func (Binary) MarshalJSON

func (binary Binary) MarshalJSON() ([]byte, error)

MarshalJSON implements a custom marshal function to encode the Binary as a hex string. MarshalJSON implements the json.Marshaler interface. Supports JSON null.

func (Binary) MarshalText

func (binary Binary) MarshalText() ([]byte, error)

MarshalText implements a custom marhsal function to encode the Binary as hex. MarshalText implements the encoding.TextMarshaler interface.

func (*Binary) Scan

func (binary *Binary) Scan(src interface{}) error

Scan implements the sql.Scanner interface. Supports SQL NULL.

func (Binary) String

func (binary Binary) String() string

String returns the hex string representation form of the Binary.

func (*Binary) UnmarshalJSON

func (binary *Binary) UnmarshalJSON(data []byte) error

UnmarshalJSON implements a custom unmarshal function to decode a JSON hex string into a Binary. UnmarshalJSON implements the json.Unmarshaler interface. Supports JSON null.

func (*Binary) UnmarshalText

func (binary *Binary) UnmarshalText(text []byte) error

UnmarshalText implements a custom unmarshal function to decode hex into a Binary. UnmarshalText implements the encoding.TextUnmarshaler interface.

func (Binary) Valid

func (binary Binary) Valid() bool

Valid returns whether the Binary is valid.

func (Binary) Value

func (binary Binary) Value() (driver.Value, error)

Value implements the driver.Valuer interface. Supports SQL NULL.

type Bool

type Bool struct {
	Bool  bool
	Valid bool // Valid is true if Bool is not NULL
}

Bool represents a bool for ENUM ('y', 'n'), which can be NULL.

func (Bool) MarshalJSON

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

MarshalJSON implements the json.Marshaler interface.

func (*Bool) Scan

func (b *Bool) Scan(src interface{}) error

Scan implements the sql.Scanner interface. Supports SQL NULL.

func (*Bool) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaler interface.

func (*Bool) UnmarshalText

func (b *Bool) UnmarshalText(text []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface.

func (Bool) Value

func (b Bool) Value() (driver.Value, error)

Value implements the driver.Valuer interface. Supports SQL NULL.

type CommentType

type CommentType uint8

CommentType specifies a comment's origin's kind.

func (*CommentType) UnmarshalJSON

func (ct *CommentType) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

func (*CommentType) UnmarshalText

func (ct *CommentType) UnmarshalText(text []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface.

func (CommentType) Value

func (ct CommentType) Value() (driver.Value, error)

Value implements the driver.Valuer interface.

type Float

type Float struct {
	sql.NullFloat64
}

Float adds JSON support to sql.NullFloat64.

func (Float) MarshalJSON

func (f Float) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface. Supports JSON null.

func (*Float) UnmarshalJSON

func (f *Float) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface. Supports JSON null.

func (*Float) UnmarshalText

func (f *Float) UnmarshalText(text []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface.

type Int

type Int struct {
	sql.NullInt64
}

Int adds JSON support to sql.NullInt64.

func (Int) MarshalJSON

func (i Int) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface. Supports JSON null.

func (*Int) UnmarshalJSON

func (i *Int) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface. Supports JSON null.

func (*Int) UnmarshalText

func (i *Int) UnmarshalText(text []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface.

type NotificationStates

type NotificationStates uint8

NotificationStates specifies the set of states a notification may be sent for.

func (*NotificationStates) UnmarshalJSON

func (nst *NotificationStates) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

func (*NotificationStates) UnmarshalText

func (nst *NotificationStates) UnmarshalText(text []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface.

func (NotificationStates) Value

func (nst NotificationStates) Value() (driver.Value, error)

Value implements the driver.Valuer interface.

type NotificationType

type NotificationType uint16

NotificationType specifies the reason of a sent notification.

func (*NotificationType) UnmarshalText

func (nt *NotificationType) UnmarshalText(text []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface.

func (NotificationType) Value

func (nt NotificationType) Value() (driver.Value, error)

Value implements the driver.Valuer interface.

type NotificationTypes

type NotificationTypes uint16

NotificationTypes specifies the set of reasons a notification may be sent for.

func (*NotificationTypes) UnmarshalJSON

func (nt *NotificationTypes) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

func (*NotificationTypes) UnmarshalText

func (nt *NotificationTypes) UnmarshalText(text []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface.

func (NotificationTypes) Value

func (nt NotificationTypes) Value() (driver.Value, error)

Value implements the driver.Valuer interface.

type StateType

type StateType uint8

StateType specifies a state's hardness.

func (*StateType) UnmarshalJSON

func (st *StateType) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

func (*StateType) UnmarshalText

func (st *StateType) UnmarshalText(text []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface.

func (StateType) Value

func (st StateType) Value() (driver.Value, error)

Value implements the driver.Valuer interface.

type String

type String struct {
	sql.NullString
}

String adds JSON support to sql.NullString.

func MakeString added in v1.2.0

func MakeString(s string) String

MakeString constructs a new non-NULL String from s.

func (String) MarshalJSON

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

MarshalJSON implements the json.Marshaler interface. Supports JSON null.

func (*String) UnmarshalJSON

func (s *String) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface. Supports JSON null.

func (*String) UnmarshalText

func (s *String) UnmarshalText(text []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface.

func (String) Value

func (s String) Value() (driver.Value, error)

Value implements the driver.Valuer interface. Supports SQL NULL.

type UUID

type UUID struct {
	uuid.UUID
}

UUID is like uuid.UUID, but marshals itself binarily (not like xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx) in SQL context.

func (UUID) Value

func (uuid UUID) Value() (driver.Value, error)

Value implements driver.Valuer.

type UnixMilli

type UnixMilli time.Time

UnixMilli is a nullable millisecond UNIX timestamp in databases and JSON.

func (UnixMilli) MarshalJSON

func (t UnixMilli) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface. Marshals to milliseconds. Supports JSON null.

func (*UnixMilli) Scan

func (t *UnixMilli) Scan(src interface{}) error

Scan implements the sql.Scanner interface. Scans from milliseconds. Supports SQL NULL.

func (UnixMilli) Time

func (t UnixMilli) Time() time.Time

Time returns the time.Time conversion of UnixMilli.

func (*UnixMilli) UnmarshalJSON

func (t *UnixMilli) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface. Unmarshals from milliseconds. Supports JSON null.

func (*UnixMilli) UnmarshalText

func (t *UnixMilli) UnmarshalText(text []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface.

func (UnixMilli) Value

func (t UnixMilli) Value() (driver.Value, error)

Value implements the driver.Valuer interface. Returns milliseconds. Supports SQL NULL.

Jump to

Keyboard shortcuts

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