types

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2024 License: Apache-2.0 Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrorInvalidValue = errors.New("invalid []byte value")
)

Functions

This section is empty.

Types

type IsoDate

type IsoDate time.Time

IsoDate struct

func ParseIsoDate added in v0.0.4

func ParseIsoDate(value string) (IsoDate, error)

ParseIsoDate converts string to iso date.

It takes a string value as input. Returns IsoDate and an error.

func (IsoDate) GoString added in v0.0.4

func (t IsoDate) GoString() string

GoString returns the iso date in Go source code format string.

No parameters. Returns a string.

func (IsoDate) MarshalJSON

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

MarshalJSON converts iso date to json string format.

No parameters. Returns a byte slice and an error.

func (IsoDate) String added in v0.0.4

func (t IsoDate) String() string

String returns the iso date formatted using the format string.

No parameters. Returns a string.

func (*IsoDate) UnmarshalJSON

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

UnmarshalJSON converts json string to iso date.

It takes a byte slice as the input data. Returns an error.

func (IsoDate) Value

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

Value converts iso date to sql driver value.

Returns driver.Value and an error.

type IsoTime

type IsoTime time.Time

IsoTime struct

func ParseIsoTime added in v0.0.4

func ParseIsoTime(value string) (IsoTime, error)

ParseIsoTime converts string to iso time.

It takes a string value as input. Returns IsoTime and an error.

func (IsoTime) GoString added in v0.0.4

func (t IsoTime) GoString() string

GoString returns the iso time in Go source code format string.

No parameters. Returns a string.

func (IsoTime) MarshalJSON

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

MarshalJSON converts iso time to json string format.

No parameters. Returns a byte slice and an error.

func (IsoTime) String added in v0.0.4

func (t IsoTime) String() string

String returns the iso time formatted using the format string

No parameters. Returns a string.

func (*IsoTime) UnmarshalJSON

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

UnmarshalJSON converts json string to iso time

It takes a byte slice as the input data. Returns an error.

func (IsoTime) Value

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

Value converts iso time to sql driver value.

Returns driver.Value and an error.

type JsonB added in v0.0.3

type JsonB map[string]interface{}

func (*JsonB) Scan added in v0.0.3

func (t *JsonB) Scan(value interface{}) error

func (*JsonB) Value added in v0.0.3

func (t *JsonB) Value() (driver.Value, error)

type NullBool

type NullBool sql.NullBool

NullBoll for empty boolean field

func (NullBool) MarshalJSON

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

func (*NullBool) Scan

func (t *NullBool) Scan(value interface{}) error

func (*NullBool) UnmarshalJSON

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

func (NullBool) Value

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

type NullDateTime

type NullDateTime sql.NullTime

NullDateTime for empty date/time field

func (NullDateTime) MarshalJSON

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

func (*NullDateTime) Scan

func (t *NullDateTime) Scan(value interface{}) error

func (*NullDateTime) UnmarshalJSON

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

func (NullDateTime) Value

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

type NullFloat64

type NullFloat64 sql.NullFloat64

NullFloat64 for empty float field

func (NullFloat64) MarshalJSON

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

func (*NullFloat64) Scan

func (t *NullFloat64) Scan(value interface{}) error

func (*NullFloat64) UnmarshalJSON

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

func (NullFloat64) Value

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

type NullInt16

type NullInt16 sql.NullInt16

NullInt16 for empty int16 field

func (NullInt16) MarshalJSON

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

func (*NullInt16) Scan

func (t *NullInt16) Scan(value interface{}) error

func (*NullInt16) UnmarshalJSON

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

func (NullInt16) Value

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

type NullInt32

type NullInt32 sql.NullInt32

NullInt32 for empty int32 field

func (NullInt32) MarshalJSON

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

func (*NullInt32) Scan

func (t *NullInt32) Scan(value interface{}) error

func (*NullInt32) UnmarshalJSON

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

func (NullInt32) Value

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

type NullInt64

type NullInt64 sql.NullInt64

NullInt64 for empty int64 field

func (NullInt64) MarshalJSON

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

func (*NullInt64) Scan

func (t *NullInt64) Scan(value interface{}) error

func (*NullInt64) UnmarshalJSON

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

func (NullInt64) Value

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

type NullIsoDate

type NullIsoDate sql.NullTime

NullIsoDate for empty date field

func (NullIsoDate) MarshalJSON

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

func (*NullIsoDate) Scan

func (t *NullIsoDate) Scan(value interface{}) error

func (*NullIsoDate) UnmarshalJSON

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

func (NullIsoDate) Value

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

type NullIsoTime

type NullIsoTime sql.NullTime

NullIsoTime for empty time field

func (NullIsoTime) MarshalJSON

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

func (*NullIsoTime) Scan

func (t *NullIsoTime) Scan(value interface{}) error

func (*NullIsoTime) UnmarshalJSON

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

func (NullIsoTime) Value

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

type NullString

type NullString sql.NullString

NullString for empty string field

func (NullString) MarshalJSON

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

func (*NullString) Scan

func (t *NullString) Scan(value interface{}) error

func (*NullString) UnmarshalJSON

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

func (NullString) Value

func (ns NullString) Value() (driver.Value, error)

type Page

type Page[T any] struct {
	Content       []T    `json:"content"`
	TotalElements uint64 `json:"totalElements"`
}

Page is the page response contract

type PageRequest

type PageRequest struct {
	Page  uint16
	Size  uint16
	Order []Sort
}

PageRequest is the contract of request page

func NewPageRequest

func NewPageRequest(page uint16, size uint16, order []Sort) *PageRequest

NewPageRequest returns a new page request pointer

func (*PageRequest) GetOrder

func (p *PageRequest) GetOrder() string

GetOrder returns string contains concated order list

type Sort

type Sort struct {
	Direction SortDirection
	Field     string
}

Sort is the contract to sort an field

func NewSort

func NewSort(direction SortDirection, field string) Sort

NewSort returns a new Sort

type SortDirection

type SortDirection string

SortDirection is the field sort direction

const (
	ASC  SortDirection = "ASC"
	DESC SortDirection = "DESC"
)

Jump to

Keyboard shortcuts

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