### Install gqlgen-scalars Source: https://github.com/jilio/gqlgen-scalars/blob/main/README.md Installs the gqlgen-scalars package using the go get command. ```bash go get github.com/jilio/gqlgen-scalars ``` -------------------------------- ### GraphQL Query Examples Source: https://github.com/jilio/gqlgen-scalars/blob/main/README.md Demonstrates how to query data using the custom scalar types (Base64, BigInt, Decimal, Address) in GraphQL. ```graphql query { getBase64Data getLargeNumber getPreciseDecimal getEthereumAddress } ``` -------------------------------- ### GraphQL Mutation Examples Source: https://github.com/jilio/gqlgen-scalars/blob/main/README.md Shows how to use mutations with custom scalar types (Base64, BigInt, Decimal, Address) in GraphQL. ```graphql mutation { uploadBase64Data(data: "SGVsbG8gV29ybGQ=") setLargeNumber(number: "123456789012345678901234567890") setPreciseDecimal(value: "123.45000000000000000001") setEthereumAddress(address: "0x742d35Cc6634C0532925a3b844Bc454e4438f44e") } ``` -------------------------------- ### Go Resolver Implementations Source: https://github.com/jilio/gqlgen-scalars/blob/main/README.md Provides Go implementations for custom scalar types (Base64, BigInt, Decimal, Address) used in gqlgen resolvers. ```go import ( "math/big" "github.com/shopspring/decimal" "github.com/ethereum/go-ethereum/common" "github.com/jilio/gqlgen-scalars/scalar" ) type Resolver struct{} func (r *Resolver) Base64() scalar.Base64 { return scalar.Base64("SGVsbG8gV29ybGQ=") } func (r *Resolver) BigInt() scalar.BigInt { return scalar.BigInt{big.NewInt(123456789012345678901234567890)} } func (r *Resolver) Decimal() scalar.Decimal { return scalar.NewDecimal(decimal.NewFromFloat(123.45)) } func (r *Resolver) Address() scalar.Address { return scalar.Address(common.HexToAddress("0x742d35Cc6634C0532925a3b844Bc454e4438f44e")) } ``` -------------------------------- ### gqlgen.yml Configuration Source: https://github.com/jilio/gqlgen-scalars/blob/main/README.md Configures gqlgen to map GraphQL scalar types to Go models provided by the gqlgen-scalars package. ```yaml models: Base64: model: github.com/jilio/gqlgen-scalars/scalar.Base64 BigInt: model: github.com/jilio/gqlgen-scalars/scalar.BigInt Decimal: model: github.com/jilio/gqlgen-scalars/scalar.Decimal Address: model: github.com/jilio/gqlgen-scalars/scalar.Address ``` -------------------------------- ### GraphQL Schema Definition Source: https://github.com/jilio/gqlgen-scalars/blob/main/README.md Defines custom scalar types (Base64, BigInt, Decimal, Address) in a GraphQL schema. ```graphql scalar Base64 scalar BigInt scalar Decimal scalar Address ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.