my gqlgen go app with postgres
based on the schema when i try to implement the function it display error as it is not bigint type for the user id, but the user id in the user struct generated by gqlgen are string
//my schema
type Query {
getUser(id: ID!): Users!
listUsers: [Users!]!
}
type Mutation {
createUser(input: CreateUserInput!): Users!
updateUser(input: UpdateUserInput!): Users!
deleteUser(id: ID!): Boolean!
}
type Users {
id: ID!
name: String!
email: String!
}
input CreateUserInput {
name: String!
email: String!
}
input UpdateUserInput {
id: ID!
name: String
email: String
}
//my resolver function
// CreateUser is the resolver for the createUser field.
func (r *mutationResolver) CreateUser(ctx context.Context, input model.CreateUserInput) (*model.Users, error) {
// Create a new user object
user := &model.Users{
ID:uuid.new().string()
Name: input.Name,
Email: input.Email,
}
fmt.Println("frfrf" + user.ID)
// TODO: Implement the code to save the user to the database using go-pg
// Example code:
_, err := r.DB.Model(user).Insert()
// Check for any errors
if err != nil {
return nil, err
}
// Return the created user
return user, nil
}