gj

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: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeOptUint8

func DecodeOptUint8(dec *gojay.Decoder) (*uint8, error)

func DecodeReqTime

func DecodeReqTime(dec *gojay.Decoder) (time.Time, error)

func DecodeTime

func DecodeTime(dec *gojay.Decoder) (*time.Time, error)

func EncodeTime

func EncodeTime(t *time.Time) *string

Types

type EncWrapper

type EncWrapper interface {
	// AddBool appends the given boolean value to the output encoder.
	AddBool(key serial.Key, val bool) EncWrapper

	// AddOptionalBool appends the given boolean pointer to the output encoder
	// only if the pointer is not nil.
	AddOptionalBool(key serial.Key, val *bool) EncWrapper

	// AddNullableBool appends either the given boolean pointer or a null value to
	// the output encoder based on whether the given pointer is nil.
	AddNullableBool(key serial.Key, val *bool) EncWrapper

	// AddTriStateBool may append either the given boolean pointer or a null value
	// to the output encoder based on whether the given pointer is nil and the
	// value of the given null flag.
	//
	// If the given boolean pointer is not nil, the value will be appended to the
	// output encoder.
	//
	// Else, if the null flag is false and the given pointer is nil, nothing will
	// be appended to the output encoder.
	//
	// Else, if the null flag is true and the given pointer is nil, a null value
	// will be appended to the output encoder.
	AddTriStateBool(key serial.Key, val *bool, null bool) EncWrapper

	// AddSlice appends the given slice/array value to the output encoder.
	//
	// If the given slice is nil, an empty json array will be appended to the
	// output encoder.
	AddSlice(key serial.Key, val gojay.MarshalerJSONArray) EncWrapper

	// AddOptionalSlice appends the given slice/array value to the output encoder
	// only if the value is not nil.
	AddOptionalSlice(
		key serial.Key,
		val gojay.MarshalerJSONArray,
		empty bool,
	) EncWrapper

	// AddNullableSlice appends either the given slice/array value or a null value
	// to the output encoder based on whether the given value is nil.
	AddNullableSlice(
		key serial.Key,
		val gojay.MarshalerJSONArray,
		null bool,
	) EncWrapper

	// AddTriStateSlice may append either the given slice/array value or a null
	// value to the output encoder based on whether the given pointer is nil and
	// the value of the given null flag.
	//
	// If the given slice/array value is not nil, the value will be appended to
	// the output encoder.
	//
	// Else, if the empty flag is true and the given value is nil, nothing will
	// be appended to the output encoder.
	//
	// Else, if the null flag is true and the given value is nil, a null value
	// will be appended to the output encoder.
	//
	// Else, if neither the empty flag or null flag is true, and the given value
	// is nil, an empty json array will be appended to the output encoder.
	//
	// Note: If both the empty flag and the null flag are true, the empty flag
	// takes priority, meaning nothing will be appended to the output encoder.
	AddTriStateSlice(
		key serial.Key,
		val gojay.MarshalerJSONArray,
		empty bool,
		null bool,
	) EncWrapper

	// AddString appends the given string value to the output encoder.
	AddString(key serial.Key, val string) EncWrapper

	// AddOptionalString appends the given string pointer to the output encoder
	// only if the pointer is not nil.
	AddOptionalString(key serial.Key, val *string) EncWrapper

	// AddNullableString appends either the given string pointer or a null value
	// to the output encoder based on whether the given pointer is nil.
	AddNullableString(key serial.Key, val *string) EncWrapper

	// AddStringer appends the string value of the given value to the output
	// encoder.
	AddStringer(key serial.Key, val fmt.Stringer) EncWrapper

	// AddOptionalStringer appends the string value of the given value to the
	// output encoder only if the pointer is not nil.
	AddOptionalStringer(key serial.Key, val fmt.Stringer) EncWrapper

	// AddNullableStringer appends the string value of the given value or a null
	// value to the output encoder based on whether the given pointer is nil.
	AddNullableStringer(key serial.Key, val fmt.Stringer) EncWrapper

	// AddTriStateStringer may append either the string value of the given value
	// or a null value to the output encoder based on whether the given pointer is
	// nil and the value of the given null flag.
	//
	// If the given string pointer is not nil, the value will be appended to the
	// output encoder.
	//
	// Else, if the null flag is false and the given pointer is nil, nothing will
	// be appended to the output encoder.
	//
	// Else, if the null flag is true and the given pointer is nil, a null value
	// will be appended to the output encoder.
	AddTriStateString(key serial.Key, val *string, null bool) EncWrapper

	// AddUint8 appends the given uint8 value to the output encoder.
	AddUint8(key serial.Key, val uint8) EncWrapper

	// AddOptionalUint8 appends the given uint8 pointer to the output encoder
	// only if the pointer is not nil.
	AddOptionalUint8(key serial.Key, val *uint8) EncWrapper

	// AddNullableUint8 appends either the given uint8 pointer or a null value to
	// the output encoder based on whether the given pointer is nil.
	AddNullableUint8(key serial.Key, val *uint8) EncWrapper

	// AddTriStateUint8 may append either the given uint8 pointer or a null value
	// to the output encoder based on whether the given pointer is nil and the
	// value of the given null flag.
	//
	// If the given uint8 pointer is not nil, the value will be appended to the
	// output encoder.
	//
	// Else, if the null flag is false and the given pointer is nil, nothing will
	// be appended to the output encoder.
	//
	// Else, if the null flag is true and the given pointer is nil, a null value
	// will be appended to the output encoder.
	AddTriStateUint8(key serial.Key, val *uint8, null bool) EncWrapper

	// AddUint16 appends the given uint16 value to the output encoder.
	AddUint16(key serial.Key, val uint16) EncWrapper

	// AddOptionalUint16 appends the given uint16 pointer to the output encoder
	// only if the pointer is not nil.
	AddOptionalUint16(key serial.Key, val *uint16) EncWrapper

	// AddNullableUint16 appends either the given uint16 pointer or a null value
	// to the output encoder based on whether the given pointer is nil.
	AddNullableUint16(key serial.Key, val *uint16) EncWrapper

	// AddTriStateUint16 may append either the given uint16 pointer or a null
	// value to the output encoder based on whether the given pointer is nil and
	// the value of the given null flag.
	//
	// If the given uint16 pointer is not nil, the value will be appended to the
	// output encoder.
	//
	// Else, if the null flag is false and the given pointer is nil, nothing will
	// be appended to the output encoder.
	//
	// Else, if the null flag is true and the given pointer is nil, a null value
	// will be appended to the output encoder.
	AddTriStateUint16(key serial.Key, val *uint16, null bool) EncWrapper

	// AddUint32 appends the given uint32 value to the output encoder.
	AddUint32(key serial.Key, val uint32) EncWrapper

	// AddOptionalUint32 appends the given uint32 pointer to the output encoder
	// only if the pointer is not nil.
	AddOptionalUint32(key serial.Key, val *uint32) EncWrapper

	// AddNullableUint32 appends either the given uint32 pointer or a null value
	// to the output encoder based on whether the given pointer is nil.
	AddNullableUint32(key serial.Key, val *uint32) EncWrapper

	// AddTriStateUint32 may append either the given uint32 pointer or a null
	// value to the output encoder based on whether the given pointer is nil and
	// the value of the given null flag.
	//
	// If the given uint32 pointer is not nil, the value will be appended to the
	// output encoder.
	//
	// Else, if the null flag is false and the given pointer is nil, nothing will
	// be appended to the output encoder.
	//
	// Else, if the null flag is true and the given pointer is nil, a null value
	// will be appended to the output encoder.
	AddTriStateUint32(key serial.Key, val *uint32, null bool) EncWrapper

	// AddUint64 appends the given uint64 value to the output encoder.
	AddUint64(key serial.Key, val uint64) EncWrapper

	// AddOptionalUint64 appends the given uint64 pointer to the output encoder
	// only if the pointer is not nil.
	AddOptionalUint64(key serial.Key, val *uint64) EncWrapper

	// AddNullableUint64 appends either the given uint64 pointer or a null value
	// to the output encoder based on whether the given pointer is nil.
	AddNullableUint64(key serial.Key, val *uint64) EncWrapper

	// AddTriStateUint64 may append either the given uint64 pointer or a null
	// value to the output encoder based on whether the given pointer is nil and
	// the value of the given null flag.
	//
	// If the given uint64 pointer is not nil, the value will be appended to the
	// output encoder.
	//
	// Else, if the null flag is false and the given pointer is nil, nothing will
	// be appended to the output encoder.
	//
	// Else, if the null flag is true and the given pointer is nil, a null value
	// will be appended to the output encoder.
	AddTriStateUint64(key serial.Key, val *uint64, null bool) EncWrapper

	// AddInt64 appends the given uint64 value to the output encoder.
	AddInt64(key serial.Key, val int64) EncWrapper

	// AddOptionalInt64 appends the given int64 pointer to the output encoder
	// only if the pointer is not nil.
	AddOptionalInt64(key serial.Key, val *int64) EncWrapper

	// AddNullableInt64 appends either the given int64 pointer or a null value
	// to the output encoder based on whether the given pointer is nil.
	AddNullableInt64(key serial.Key, val *int64) EncWrapper

	// AddTriStateInt64 may append either the given int64 pointer or a null
	// value to the output encoder based on whether the given pointer is nil and
	// the value of the given null flag.
	//
	// If the given int64 pointer is not nil, the value will be appended to the
	// output encoder.
	//
	// Else, if the null flag is false and the given pointer is nil, nothing will
	// be appended to the output encoder.
	//
	// Else, if the null flag is true and the given pointer is nil, a null value
	// will be appended to the output encoder.
	AddTriStateInt64(key serial.Key, val *int64, null bool) EncWrapper

	// AddSnowflake appends the given Snowflake value to the output encoder.
	//
	// If the given Snowflake value is nil, the literal string "0" will be
	// appended to the output encoder.
	AddSnowflake(key serial.Key, val discord.Snowflake) EncWrapper

	// AddOptionalSnowflake appends the given Snowflake to the output encoder
	// only if the pointer is not nil.
	AddOptionalSnowflake(key serial.Key, val discord.Snowflake) EncWrapper

	// AddNullableSnowflake appends either the given Snowflake or a null value to
	// the output encoder based on whether the given pointer is nil.
	AddNullableSnowflake(key serial.Key, val discord.Snowflake) EncWrapper

	// AddTriStateSnowflake may append either the given Snowflake or a null value
	// to the output encoder based on whether the given pointer is nil and the
	// value of the given null flag.
	//
	// If the given Snowflake is not nil, the value will be appended to the output
	// encoder.
	//
	// Else, if the null flag is false and the given pointer is nil, nothing will
	// be appended to the output encoder.
	//
	// Else, if the null flag is true and the given pointer is nil, a null value
	// will be appended to the output encoder.
	AddTriStateSnowflake(
		key serial.Key,
		val discord.Snowflake,
		null bool,
	) EncWrapper

	// AddObject appends the given object value to the output encoder.
	//
	// If the given object value is nil, an empty json object will be appended to
	// the output encoder.
	AddObject(key serial.Key, val gojay.MarshalerJSONObject) EncWrapper

	// AddOptionalObject appends the given object to the output encoder only if
	// the pointer is not nil.
	AddOptionalObject(key serial.Key, val gojay.MarshalerJSONObject) EncWrapper

	// AddNullableObject appends either the given object or a null value to the
	// output encoder based on whether the given pointer is nil.
	AddNullableObject(key serial.Key, val gojay.MarshalerJSONObject) EncWrapper

	// AddTriStateObject may append either the given object or a null value to the
	// output encoder based on whether the given pointer is nil and the value of
	// the given null flag.
	//
	// If the given object is not nil, the value will be appended to the output
	// encoder.
	//
	// Else, if the empty flag is true and the given pointer is nil, nothing will
	// be appended to the output encoder.
	//
	// Else, if the null flag is true and the given pointer is nil, a null value
	// will be appended to the output encoder.
	AddTriStateObject(
		key serial.Key,
		val gojay.MarshalerJSONObject,
		null bool,
	) EncWrapper
}

func NewEncWrapper

func NewEncWrapper(enc *gojay.Encoder) EncWrapper

Jump to

Keyboard shortcuts

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