scalars

package module
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2022 License: MIT Imports: 6 Imported by: 1

README

go-graphql-scalars

A collection of GraphQL (gqlgen) Scalars with SQLBoiler's null support

Install

go get -u "github.com/nrfta/go-graphql-scalars"

Usage

# scalars.graphql

"The `Date` is a date in the format YYYY-MM-DD"
scalar Date

"The `DateTime` is a date in the format ISO 8601 format: `2006-01-02T15:04:05Z07:00`"
scalar DateTime
# gqlgen.yml

schema:
  - "./*.graphql"

models:
  # -- Start Scalars --
  String:
    model:
      - github.com/99designs/gqlgen/graphql.String
      - github.com/nrfta/go-graphql-scalars.NullString
  Boolean:
    model:
      - github.com/99designs/gqlgen/graphql.Boolean
      - github.com/nrfta/go-graphql-scalars.NullBoolean
  Float:
    model:
      - github.com/99designs/gqlgen/graphql.Float
      - github.com/nrfta/go-graphql-scalars.NullFloat64
  Int:
    model:
      - github.com/99designs/gqlgen/graphql.Int
      - github.com/99designs/gqlgen/graphql.Int32
      - github.com/99designs/gqlgen/graphql.Int64
      - github.com/nrfta/go-graphql-scalars.NullInt
  Date:
    model:
      - github.com/nrfta/go-graphql-scalars.Date
      - github.com/nrfta/go-graphql-scalars.NullDate
  DateTime:
    model:
      - github.com/nrfta/go-graphql-scalars.DateTime
      - github.com/nrfta/go-graphql-scalars.NullDateTime
  # -- End Scalars --

License

This project is licensed under the MIT License.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MarshalDate

func MarshalDate(t time.Time) graphql.Marshaler

func MarshalDateTime

func MarshalDateTime(t time.Time) graphql.Marshaler

func MarshalNullBoolean

func MarshalNullBoolean(ns null.Bool) graphql.Marshaler

func MarshalNullDate

func MarshalNullDate(t null.Time) graphql.Marshaler

func MarshalNullDateTime

func MarshalNullDateTime(t null.Time) graphql.Marshaler

func MarshalNullFloat64

func MarshalNullFloat64(ns null.Float64) graphql.Marshaler

func MarshalNullInt

func MarshalNullInt(ns null.Int) graphql.Marshaler

func MarshalNullString

func MarshalNullString(ns null.String) graphql.Marshaler

func UnmarshalDate

func UnmarshalDate(v interface{}) (time.Time, error)

func UnmarshalDateTime

func UnmarshalDateTime(v interface{}) (time.Time, error)

func UnmarshalNullBoolean

func UnmarshalNullBoolean(v interface{}) (null.Bool, error)

func UnmarshalNullDate

func UnmarshalNullDate(v interface{}) (null.Time, error)

func UnmarshalNullDateTime

func UnmarshalNullDateTime(v interface{}) (null.Time, error)

func UnmarshalNullFloat64

func UnmarshalNullFloat64(v interface{}) (null.Float64, error)

func UnmarshalNullInt

func UnmarshalNullInt(v interface{}) (null.Int, error)

func UnmarshalNullString

func UnmarshalNullString(v interface{}) (null.String, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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