scalars

package module
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2025 License: MIT Imports: 9 Imported by: 1 module, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

scalar JSON
# 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 MarshalJSON added in v0.3.0

func MarshalJSON(j JSON) graphql.Marshaler

MarshalJSON implements the graphql.Marshaler interface for JSON

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

type JSON added in v0.3.0

type JSON json.RawMessage

JSON represents a custom scalar for raw JSON data

func UnmarshalJSON added in v0.3.0

func UnmarshalJSON(v interface{}) (JSON, error)

UnmarshalJSON implements the graphql.Unmarshaler interface for JSON

Jump to

Keyboard shortcuts

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