@crawlo/graphql v1.0.39
@crawlo/graphql
let's consider this type
import { GraphQLObjectType, GraphQLString, GraphQLID } from "@crawlo/graphql";
const Type = new GraphQLObjectType({
name: "Example",
fields: {
id: {
type: GraphQLID,
},
name: {
type: GraphQLString,
},
},
});
getConfig(Type)
getConfig(Type) will return the fields used of Type, in graphql fields could be an object or a function, getConfig(Type) returns the object eitherwa
import { getConfig } from "@crawlo/graphql";
let fields = getConfig(Type);
// fields = {
// id: {
// type: GraphQLID
// },
// name: {
// type: GraphQLString
// }
// }
getInputObjectType(Type)
getInputObjectType(Type) will create a GraphQLInputObjectType with the same fields of Type
import { getInputObjectType } from "@crawlo/graphql";
let inputType = getInputObjectType(Type);
// inputType = new GraphQLInputObjectType({
// name: 'ExampleInput',
// fields: {
// id: {
// type: GraphQLID
// },
// name: {
// type: GraphQLString
// }
// }
// })
getErrorType(Type)
get a type with the same fields of Type for Errors
Scalar
Scalar is a scalar type for grahql, it can be a String, Boolean, Integer, Float, Object or Array
import {
GraphQLObjectType,
GraphQLString,
GraphQLID,
Scalar,
} from "@crawlo/graphql";
const Type = new GraphQLObjectType({
name: "ScalarExample",
fields: {
id: {
type: GraphQLID,
},
type: {
type: GraphQLString,
},
data: {
type: Scalar,
},
},
});
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago