model

package
v0.0.0-...-7debb38 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AllGender = []Gender{
	GenderM,
	GenderF,
}

AllGender retrieve all available gender identifiers

Functions

func MarshalTimestamp

func MarshalTimestamp(t Timestamp) graphql.Marshaler

MarshalTimestamp custom graphql marshalling for Timestamps

Types

type Crocodile

type Crocodile struct {
	ID        int        `json:"id"`
	Name      string     `json:"name"`
	Sex       Gender     `json:"sex"`
	BirthDate *Timestamp `json:"date_of_birth"`
	Age       int        `json:"age"`
}

Crocodile main crocodile model definition

type CrocodileInput

type CrocodileInput struct {
	Name      string     `json:"name"`
	Sex       Gender     `json:"sex"`
	BirthDate *Timestamp `json:"date_of_birth"`
	Age       int        `json:"age"`
}

CrocodileInput DTO used to create new/edit crocs

type Gender

type Gender string

Gender constant used to define available gender types

const (
	// GenderM male crocodile identifier
	GenderM Gender = "M"
	// GenderF female crocodile identifier
	GenderF Gender = "F"
)

func (Gender) IsValid

func (e Gender) IsValid() bool

IsValid define whether the provided gender is a valid constant

func (Gender) MarshalGQL

func (e Gender) MarshalGQL(w io.Writer)

MarshalGQL custom gender GraphQL marshalling

func (Gender) String

func (e Gender) String() string

func (*Gender) UnmarshalGQL

func (e *Gender) UnmarshalGQL(v interface{}) error

UnmarshalGQL custom gender GraphQL unmarshalling

type Timestamp

type Timestamp struct{ *time.Time }

Timestamp holder used to add custom date marshalling/unmarshalling

func UnmarshalTimestamp

func UnmarshalTimestamp(v interface{}) (Timestamp, error)

UnmarshalTimestamp custom graphql unmarshalling for Timestamps

func (*Timestamp) MarshalJSON

func (t *Timestamp) MarshalJSON() ([]byte, error)

MarshalJSON custom timestamp marshaller

func (*Timestamp) UnmarshalJSON

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

UnmarshalJSON custom timestamp unmarshaller

Jump to

Keyboard shortcuts

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