types

package
v0.0.0-...-d49a382 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2020 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnsetField = errors.New("cannot get a value from an absent field; " +
		"use the *IsSet method before attempting to unwrap a nullable field")
	ErrSerializeUnset    = errors.New("cannot serialize an absent field")
	ErrSetNilOptionalVal = errors.New("attempted to set a nil value using an" +
		" OptionalField's Set method")
)
View Source
var (
	ErrNullField = errors.New("cannot get a value from a null field; use " +
		"the *IsNull method before attempting to unwrap a nullable field")
)
View Source
var (
	ErrSetNilTriStateVal = errors.New("attempted to set a nil value using a" +
		" TriStateField's Set method")
)

Functions

func NewJSONImageData

func NewJSONImageData(in []byte) (ImageData, error)

NewJSONImageData constructs an ImageData instance from the given JSON byte slice.

This method is intended to allow creating a new ImageData instance without having a local copy of the image data.

Types

type ImageDataImpl

type ImageDataImpl struct {
	Input io.ReadSeeker
	Form  ImageFormat
	X, Y  uint16
}

func (*ImageDataImpl) AspectRatio

func (i *ImageDataImpl) AspectRatio() lib.AspectRatio

func (*ImageDataImpl) Close

func (i *ImageDataImpl) Close() error

Close will attempt to close the input io.ReadSeeker instance if it is also an instance of io.Closer.

If the input io.ReadSeeker is not also an instance of io.Closer, then this method will do nothing.

func (*ImageDataImpl) Format

func (i *ImageDataImpl) Format() ImageFormat

func (*ImageDataImpl) Height

func (i *ImageDataImpl) Height() uint16

func (*ImageDataImpl) MarshalJSON

func (i *ImageDataImpl) MarshalJSON() ([]byte, error)

func (*ImageDataImpl) String

func (i *ImageDataImpl) String() (string, error)

func (*ImageDataImpl) UnmarshalJSON

func (i *ImageDataImpl) UnmarshalJSON(in []byte) error

UnmarshalJSON attempts to deserialize a string encoded image data value into the current ImageData instance.

This method may return one of the following library errors:

image.ErrBadImageDataSize = The base64 encoded image data is too small to be a valid image, it may have been truncated by the source. See image.MinPossibleImageString.

image.ErrBadImageDataJsonType = The value passed to this method was not a string.

image.ErrBadImageDataFormat = The given image data string is corrupt or malformed and contains no divider between the prefix and the actual image data.

image.ErrBadImageFormat = The input image data string is not of a type recognized by this library. See image.ImageFormat for the list of allowed types.

image.ErrTypeMismatch = The image format declared in the image data string's prefix does not match the actual type of the base64 encoded image.

In addition to the above errors, this method may return errors from the standard library's `image` or `base64` packages, or any error returned from attempting to close the previous image data held by this ImageData instance.

func (*ImageDataImpl) Width

func (i *ImageDataImpl) Width() uint16

type NullContainer

type NullContainer interface {
	// IsNull returns whether the current field value is null.
	IsNull() bool

	// IsNotNull returns whether the current field value is not null.
	IsNotNull() bool
}

type NullableActivityAssets

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

func (NullableActivityAssets) Get

Value returns the raw wrapped field value.

This method panics if the field is marked as null.

func (NullableActivityAssets) IsNotNull

func (i NullableActivityAssets) IsNotNull() bool

func (NullableActivityAssets) IsNull

func (i NullableActivityAssets) IsNull() bool

func (*NullableActivityAssets) MarshalJSON

func (i *NullableActivityAssets) MarshalJSON() ([]byte, error)

func (*NullableActivityAssets) Set

func (*NullableActivityAssets) SetNull

func (*NullableActivityAssets) UnmarshalJSON

func (i *NullableActivityAssets) UnmarshalJSON(bytes []byte) error

type NullableActivityEmoji

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

func (NullableActivityEmoji) Get

Value returns the raw wrapped field value.

This method panics if the field is marked as null.

func (NullableActivityEmoji) IsNotNull

func (i NullableActivityEmoji) IsNotNull() bool

func (NullableActivityEmoji) IsNull

func (i NullableActivityEmoji) IsNull() bool

func (*NullableActivityEmoji) MarshalJSON

func (i *NullableActivityEmoji) MarshalJSON() ([]byte, error)

func (*NullableActivityEmoji) Set

func (*NullableActivityEmoji) SetNull

func (i *NullableActivityEmoji) SetNull() NullableField

func (*NullableActivityEmoji) UnmarshalJSON

func (i *NullableActivityEmoji) UnmarshalJSON(bytes []byte) error

type NullableActivityParty

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

func (NullableActivityParty) Get

Value returns the raw wrapped field value.

This method panics if the field is marked as null.

func (NullableActivityParty) IsNotNull

func (i NullableActivityParty) IsNotNull() bool

func (NullableActivityParty) IsNull

func (i NullableActivityParty) IsNull() bool

func (*NullableActivityParty) MarshalJSON

func (i *NullableActivityParty) MarshalJSON() ([]byte, error)

func (*NullableActivityParty) Set

func (*NullableActivityParty) SetNull

func (i *NullableActivityParty) SetNull() NullableField

func (*NullableActivityParty) UnmarshalJSON

func (i *NullableActivityParty) UnmarshalJSON(bytes []byte) error

type NullableActivitySecrets

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

func (NullableActivitySecrets) Get

Value returns the raw wrapped field value.

This method panics if the field is marked as null.

func (NullableActivitySecrets) IsNotNull

func (i NullableActivitySecrets) IsNotNull() bool

func (NullableActivitySecrets) IsNull

func (i NullableActivitySecrets) IsNull() bool

func (*NullableActivitySecrets) MarshalJSON

func (i *NullableActivitySecrets) MarshalJSON() ([]byte, error)

func (*NullableActivitySecrets) Set

func (*NullableActivitySecrets) SetNull

func (*NullableActivitySecrets) UnmarshalJSON

func (i *NullableActivitySecrets) UnmarshalJSON(bytes []byte) error

type NullableAny

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

func (NullableAny) Get

func (i NullableAny) Get() interface{}

Value returns the raw wrapped field value.

This method panics if the field is marked as null.

func (NullableAny) IsNotNull

func (i NullableAny) IsNotNull() bool

func (NullableAny) IsNull

func (i NullableAny) IsNull() bool

func (*NullableAny) MarshalJSON

func (i *NullableAny) MarshalJSON() ([]byte, error)

func (*NullableAny) Set

func (i *NullableAny) Set(val interface{}) NullableField

func (*NullableAny) SetNull

func (i *NullableAny) SetNull() NullableField

func (*NullableAny) UnmarshalJSON

func (i *NullableAny) UnmarshalJSON(bytes []byte) error

type NullableChannelTopic

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

func (NullableChannelTopic) Get

Value returns the raw wrapped field value.

This method panics if the field is marked as null.

func (NullableChannelTopic) IsNotNull

func (i NullableChannelTopic) IsNotNull() bool

func (NullableChannelTopic) IsNull

func (i NullableChannelTopic) IsNull() bool

func (*NullableChannelTopic) MarshalJSON

func (i *NullableChannelTopic) MarshalJSON() ([]byte, error)

func (*NullableChannelTopic) Set

func (*NullableChannelTopic) SetNull

func (i *NullableChannelTopic) SetNull() NullableField

func (*NullableChannelTopic) UnmarshalJSON

func (i *NullableChannelTopic) UnmarshalJSON(bytes []byte) error

type NullableExplicitContentFilterLevel

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

func (NullableExplicitContentFilterLevel) Get

Value returns the raw wrapped field value.

This method panics if the field is marked as null.

func (NullableExplicitContentFilterLevel) IsNotNull

func (NullableExplicitContentFilterLevel) IsNull

func (*NullableExplicitContentFilterLevel) MarshalJSON

func (i *NullableExplicitContentFilterLevel) MarshalJSON() ([]byte, error)

func (*NullableExplicitContentFilterLevel) Set

func (*NullableExplicitContentFilterLevel) SetNull

func (*NullableExplicitContentFilterLevel) UnmarshalJSON

func (i *NullableExplicitContentFilterLevel) UnmarshalJSON(bytes []byte) error

type NullableField

type NullableField interface {
	json.Marshaler
	json.Unmarshaler

	NullContainer

	// SetNull sets the current field to null.
	SetNull() NullableField
}

type NullableMessageNotificationLevel

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

func (NullableMessageNotificationLevel) Get

Value returns the raw wrapped field value.

This method panics if the field is marked as null.

func (NullableMessageNotificationLevel) IsNotNull

func (i NullableMessageNotificationLevel) IsNotNull() bool

func (NullableMessageNotificationLevel) IsNull

func (*NullableMessageNotificationLevel) MarshalJSON

func (i *NullableMessageNotificationLevel) MarshalJSON() ([]byte, error)

func (*NullableMessageNotificationLevel) Set

func (*NullableMessageNotificationLevel) SetNull

func (*NullableMessageNotificationLevel) UnmarshalJSON

func (i *NullableMessageNotificationLevel) UnmarshalJSON(bytes []byte) error

type NullableSnowflake

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

func (NullableSnowflake) Get

Value returns the raw wrapped field value.

This method panics if the field is marked as null.

func (NullableSnowflake) IsNotNull

func (i NullableSnowflake) IsNotNull() bool

func (NullableSnowflake) IsNull

func (i NullableSnowflake) IsNull() bool

func (*NullableSnowflake) MarshalJSON

func (i *NullableSnowflake) MarshalJSON() ([]byte, error)

func (*NullableSnowflake) Set

func (*NullableSnowflake) SetNull

func (i *NullableSnowflake) SetNull() NullableField

func (*NullableSnowflake) UnmarshalJSON

func (i *NullableSnowflake) UnmarshalJSON(bytes []byte) error

type NullableString

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

func (NullableString) Get

func (i NullableString) Get() string

Value returns the raw wrapped field value.

This method panics if the field is marked as null.

func (NullableString) IsNotNull

func (i NullableString) IsNotNull() bool

func (NullableString) IsNull

func (i NullableString) IsNull() bool

func (*NullableString) MarshalJSON

func (i *NullableString) MarshalJSON() ([]byte, error)

func (*NullableString) Set

func (i *NullableString) Set(val string) NullableField

func (*NullableString) SetNull

func (i *NullableString) SetNull() NullableField

func (*NullableString) UnmarshalJSON

func (i *NullableString) UnmarshalJSON(bytes []byte) error

type NullableTime

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

func (NullableTime) Get

func (i NullableTime) Get() time.Time

Value returns the raw wrapped field value.

This method panics if the field is marked as null.

func (NullableTime) IsNotNull

func (i NullableTime) IsNotNull() bool

func (NullableTime) IsNull

func (i NullableTime) IsNull() bool

func (*NullableTime) MarshalJSON

func (i *NullableTime) MarshalJSON() ([]byte, error)

func (*NullableTime) Set

func (i *NullableTime) Set(val time.Time) NullableField

func (*NullableTime) SetNull

func (i *NullableTime) SetNull() NullableField

func (*NullableTime) UnmarshalJSON

func (i *NullableTime) UnmarshalJSON(bytes []byte) error

type NullableVerificationLevel

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

func (NullableVerificationLevel) Get

Value returns the raw wrapped field value.

This method panics if the field is marked as null.

func (NullableVerificationLevel) IsNotNull

func (i NullableVerificationLevel) IsNotNull() bool

func (NullableVerificationLevel) IsNull

func (i NullableVerificationLevel) IsNull() bool

func (*NullableVerificationLevel) MarshalJSON

func (i *NullableVerificationLevel) MarshalJSON() ([]byte, error)

func (*NullableVerificationLevel) Set

func (*NullableVerificationLevel) SetNull

func (*NullableVerificationLevel) UnmarshalJSON

func (i *NullableVerificationLevel) UnmarshalJSON(bytes []byte) error

type OptionContainer

type OptionContainer interface {
	// IsSet returns whether the current field value is present.
	IsSet() bool

	// IsUnset returns whether the current field value is absent.
	IsUnset() bool
}

type OptionalAny

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

func (OptionalAny) Get

func (i OptionalAny) Get() interface{}

Value returns the raw value contained by this field.

If this field is unset, this method will panic.

func (OptionalAny) IsSet

func (i OptionalAny) IsSet() bool

func (OptionalAny) IsUnset

func (i OptionalAny) IsUnset() bool

func (*OptionalAny) MarshalJSON

func (i *OptionalAny) MarshalJSON() ([]byte, error)

func (*OptionalAny) Set

func (i *OptionalAny) Set(val interface{}) OptionalField

func (*OptionalAny) UnmarshalJSON

func (i *OptionalAny) UnmarshalJSON(bytes []byte) error

func (*OptionalAny) Unset

func (i *OptionalAny) Unset() OptionalField

type OptionalBool

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

func (OptionalBool) Get

func (i OptionalBool) Get() bool

Value returns the raw value contained by this field.

If this field is unset, this method will panic.

func (OptionalBool) IsSet

func (i OptionalBool) IsSet() bool

func (OptionalBool) IsUnset

func (i OptionalBool) IsUnset() bool

func (*OptionalBool) MarshalJSON

func (i *OptionalBool) MarshalJSON() ([]byte, error)

func (*OptionalBool) Set

func (i *OptionalBool) Set(val bool) OptionalField

func (*OptionalBool) UnmarshalJSON

func (i *OptionalBool) UnmarshalJSON(bytes []byte) error

func (*OptionalBool) Unset

func (i *OptionalBool) Unset() OptionalField

type OptionalField

type OptionalField interface {
	json.Marshaler
	json.Unmarshaler

	OptionContainer

	// Unset marks the field as absent.
	Unset() OptionalField
}

type OptionalSnowflake

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

func (OptionalSnowflake) Get

Value returns the raw value contained by this field.

If this field is unset, this method will panic.

func (OptionalSnowflake) IsSet

func (i OptionalSnowflake) IsSet() bool

func (OptionalSnowflake) IsUnset

func (i OptionalSnowflake) IsUnset() bool

func (*OptionalSnowflake) MarshalJSON

func (i *OptionalSnowflake) MarshalJSON() ([]byte, error)

func (*OptionalSnowflake) Set

func (*OptionalSnowflake) UnmarshalJSON

func (i *OptionalSnowflake) UnmarshalJSON(bytes []byte) error

func (*OptionalSnowflake) Unset

func (i *OptionalSnowflake) Unset() OptionalField

type OptionalString

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

func (OptionalString) Get

func (i OptionalString) Get() string

Value returns the raw value contained by this field.

If this field is unset, this method will panic.

func (OptionalString) IsSet

func (i OptionalString) IsSet() bool

func (OptionalString) IsUnset

func (i OptionalString) IsUnset() bool

func (*OptionalString) MarshalJSON

func (i *OptionalString) MarshalJSON() ([]byte, error)

func (*OptionalString) Set

func (i *OptionalString) Set(val string) OptionalField

func (*OptionalString) UnmarshalJSON

func (i *OptionalString) UnmarshalJSON(bytes []byte) error

func (*OptionalString) Unset

func (i *OptionalString) Unset() OptionalField

type OptionalUint16

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

func (OptionalUint16) Get

func (i OptionalUint16) Get() uint16

Value returns the raw value contained by this field.

If this field is unset, this method will panic.

func (OptionalUint16) IsSet

func (i OptionalUint16) IsSet() bool

func (OptionalUint16) IsUnset

func (i OptionalUint16) IsUnset() bool

func (*OptionalUint16) MarshalJSON

func (i *OptionalUint16) MarshalJSON() ([]byte, error)

func (*OptionalUint16) Set

func (i *OptionalUint16) Set(val uint16) OptionalField

func (*OptionalUint16) UnmarshalJSON

func (i *OptionalUint16) UnmarshalJSON(bytes []byte) error

func (*OptionalUint16) Unset

func (i *OptionalUint16) Unset() OptionalField

type OptionalUint64

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

func (OptionalUint64) Get

func (i OptionalUint64) Get() uint64

Value returns the raw value contained by this field.

If this field is unset, this method will panic.

func (OptionalUint64) IsSet

func (i OptionalUint64) IsSet() bool

func (OptionalUint64) IsUnset

func (i OptionalUint64) IsUnset() bool

func (*OptionalUint64) MarshalJSON

func (i *OptionalUint64) MarshalJSON() ([]byte, error)

func (*OptionalUint64) Set

func (i *OptionalUint64) Set(val uint64) OptionalField

func (*OptionalUint64) UnmarshalJSON

func (i *OptionalUint64) UnmarshalJSON(bytes []byte) error

func (*OptionalUint64) Unset

func (i *OptionalUint64) Unset() OptionalField

type OptionalUint8

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

func (OptionalUint8) Get

func (i OptionalUint8) Get() uint8

Value returns the raw value contained by this field.

If this field is unset, this method will panic.

func (OptionalUint8) IsSet

func (i OptionalUint8) IsSet() bool

func (OptionalUint8) IsUnset

func (i OptionalUint8) IsUnset() bool

func (*OptionalUint8) MarshalJSON

func (i *OptionalUint8) MarshalJSON() ([]byte, error)

func (*OptionalUint8) Set

func (i *OptionalUint8) Set(val uint8) OptionalField

func (*OptionalUint8) UnmarshalJSON

func (i *OptionalUint8) UnmarshalJSON(bytes []byte) error

func (*OptionalUint8) Unset

func (i *OptionalUint8) Unset() OptionalField

type OutBuilder

type OutBuilder map[serial.Key]interface{}

func (OutBuilder) AppendNullable

func (o OutBuilder) AppendNullable(k serial.Key, v NullableField) OutBuilder

func (OutBuilder) AppendOptional

func (o OutBuilder) AppendOptional(k serial.Key, v OptionalField) OutBuilder

func (OutBuilder) AppendRaw

func (o OutBuilder) AppendRaw(k serial.Key, v interface{}) OutBuilder

func (OutBuilder) AppendTriState

func (o OutBuilder) AppendTriState(k serial.Key, v TriStateField) OutBuilder

type TriStateField

type TriStateField interface {
	json.Marshaler
	json.Unmarshaler

	OptionContainer
	NullContainer

	// SetNull sets the current field value to null.
	SetNull() TriStateField

	// Unset marks the current field as absent.
	Unset() TriStateField

	// IsReadable returns true if the current field is set and non-null.
	IsReadable() bool
}

TriStateField represents a field which may be absent, null, or containing a value.

type TriStateString

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

TriStateString represents a(n) string field which may be one of 3 states: filled, nil, or absent entirely.

func (TriStateString) Get

func (i TriStateString) Get() string

Get returns the current field value.

If the current field is unset or is null, this method will panic. Check if this method is safe to call by using the IsReadable method.

func (TriStateString) IsNotNull

func (i TriStateString) IsNotNull() bool

IsNotNull returns whether the value of the current field is not nil (JSON null).

This will return false if the field is null or is absent.

func (TriStateString) IsNull

func (i TriStateString) IsNull() bool

IsNull returns whether the value of the current field is nil (JSON null).

This will return false if the field contains a value or is unset.

func (TriStateString) IsReadable

func (i TriStateString) IsReadable() bool

IsReadable returns whether the field is present and readable.

Returns false if the field is unset or is null.

func (TriStateString) IsSet

func (i TriStateString) IsSet() bool

IsSet returns whether the value of the current field is present.

Returns false if the field is absent or is null.

func (TriStateString) IsUnset

func (i TriStateString) IsUnset() bool

IsUnset returns whether the value of the current field is absent/unset.

Returns false if the field contains a value or is null.

func (TriStateString) MarshalJSON

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

MarshalJSON serializes the current field to JSON.

If this field is unset, this method will return an ErrSerializeUnset error.

func (*TriStateString) Set

func (i *TriStateString) Set(val string) TriStateField

Set overwrites the current field value with the given value.

If the type is nillable and a nil value is passed here, this method will panic.

func (*TriStateString) SetNull

func (i *TriStateString) SetNull() TriStateField

SetNull overwrites the current field value with JSON null.

func (TriStateString) UnmarshalJSON

func (i TriStateString) UnmarshalJSON(bytes []byte) error

func (*TriStateString) Unset

func (i *TriStateString) Unset() TriStateField

Unset removes the current field value entirely.

type TriStateUint8

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

TriStateUint8 represents a(n) uint8 field which may be one of 3 states: filled, nil, or absent entirely.

func (TriStateUint8) Get

func (i TriStateUint8) Get() uint8

Get returns the current field value.

If the current field is unset or is null, this method will panic. Check if this method is safe to call by using the IsReadable method.

func (TriStateUint8) IsNotNull

func (i TriStateUint8) IsNotNull() bool

IsNotNull returns whether the value of the current field is not nil (JSON null).

This will return false if the field is null or is absent.

func (TriStateUint8) IsNull

func (i TriStateUint8) IsNull() bool

IsNull returns whether the value of the current field is nil (JSON null).

This will return false if the field contains a value or is unset.

func (TriStateUint8) IsReadable

func (i TriStateUint8) IsReadable() bool

IsReadable returns whether the field is present and readable.

Returns false if the field is unset or is null.

func (TriStateUint8) IsSet

func (i TriStateUint8) IsSet() bool

IsSet returns whether the value of the current field is present.

Returns false if the field is absent or is null.

func (TriStateUint8) IsUnset

func (i TriStateUint8) IsUnset() bool

IsUnset returns whether the value of the current field is absent/unset.

Returns false if the field contains a value or is null.

func (TriStateUint8) MarshalJSON

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

MarshalJSON serializes the current field to JSON.

If this field is unset, this method will return an ErrSerializeUnset error.

func (*TriStateUint8) Set

func (i *TriStateUint8) Set(val uint8) TriStateField

Set overwrites the current field value with the given value.

If the type is nillable and a nil value is passed here, this method will panic.

func (*TriStateUint8) SetNull

func (i *TriStateUint8) SetNull() TriStateField

SetNull overwrites the current field value with JSON null.

func (TriStateUint8) UnmarshalJSON

func (i TriStateUint8) UnmarshalJSON(bytes []byte) error

func (*TriStateUint8) Unset

func (i *TriStateUint8) Unset() TriStateField

Unset removes the current field value entirely.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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