Tag: go

  • Custom error status code with gqlgen + go gin

    Custom error status code with gqlgen + go gin

    2 Recently I have been updating my GO REST APIs into graphQl API’s and I came across issue where I am unable to customise my status code with gqlgen. Response I got Headers Status Code: 200 OK { data: null, errors: [ {message: "Unauthorized access", path: ["…"]} ] } Expected Header Status Code: 401 UNAUTHORISED…

  • graphql variable types

    graphql variable types

    0 I use https://github.com/shurcooL/graphql for graphql queries and I need to make the following mutation: mutation createPromotion($input: CreatePromotionInput) { createPromotion(input: $input) } with the following graphql variables: { "input": { "channel": "my_channel", "offerType": "my_offer_type", } } In my code it looks like this: type CreatePromotion struct { CreatePromotion graphql.String } func (g *Gate) CreatePromotion(ctx context.Context)…

  • golang graphql variable types

    golang graphql variable types

    -1 in my golang project I use https://github.com/shurcooL/graphql for graphql queries and I need to make the following mutation: mutation createPromotion($input: CreatePromotionInput) { createPromotion(input: $input) } with the following graphql variables: { "input": { "channel": "my_channel", "offerType": "my_offer_type", } } In my code it looks like this: type CreatePromotion struct { CreatePromotion graphql.String } func…

  • How to generate GraphQL query from protocol buffer generated code with gqlgen?

    How to generate GraphQL query from protocol buffer generated code with gqlgen?

    0 I have a protocol buffer file which includes an enumeration within a message. message Advisor { … enum AdvisorRole { // here be values } } This pb is the input to generate stubs using protoc-gen-gogo. ../gen/ProjectService.pb.go type Advisor_AdvisorRole int32 const ( // here be constant values ) The generated code is in time…

  • Golang,gorm, postgress: invalid input is inserted

    Golang,gorm, postgress: invalid input is inserted

    0 when i perform request using https://localhost:8080/graphql end point I cant create user using mutation **the whole code:** package main import ( "fmt" "log" "net/http" "time" "github.com/graphql-go/graphql" "github.com/graphql-go/handler" "github.com/kaleabbyh/foodrecipie/config" _ "github.com/lib/pq" ) ** Note: the table users is succesfullly migrated using separate migration code having ‘User’ attributes** type User struct { ID int `gorm:"type:int;primary_key;identity(100,1)"` Name…

  • GqlGen incorrectly generates directives that have colon character in value field

    GqlGen incorrectly generates directives that have colon character in value field

    0 I use https://github.com/99designs/gqlgen for generating golang code from graphql schema. I need to be able to add gorm tags to the resulting golang types. For that, I declare a directive for custom go tags (in schema.directives.gql): directive @goTag( key: String! value: String ) on INPUT_FIELD_DEFINITION | FIELD_DEFINITION Then I use it the following way…

  • How to resolve “Error fetching schema” in gqlgen

    How to resolve “Error fetching schema” in gqlgen

    2 Good day, i am new to go and i am trying to build a graphql service with go, i did this using the go gqlgen package. Now when install and generate necessary files the initial start up, i can see the default TODO schema and resolver on the docs tab, when i implement or…