Coder Social home page Coder Social logo

Comments (5)

dosco avatar dosco commented on May 11, 2024 1

Fixed in 9c19db2

from graphjin.

frederikhors avatar frederikhors commented on May 11, 2024

I found the issue, reading your code here: https://github.com/dosco/super-graph/blob/master/core/args.go#L33.

I was passing an int and not a string for UserIDKey value in context, with this code:

ctx := context.WithValue(r.Context(), core.UserIDKey, authentication.MyID()) // int

Now I'm using this instead:

ctx := context.WithValue(r.Context(), core.UserIDKey, strconv.Itoa(authentication.MyID()))

At first I didn't notice the error because nowhere is it written that it must be a string.

Shall we create a page for config and "using SuperGraph as a library" related?

Can we specify it in code docs? Do you agree, @dosco?

image

from graphjin.

dosco avatar dosco commented on May 11, 2024

Thanks that would be very valuable if you could document your experience with using Super Graph as a library. You can add a page to this folder and i'll include it on the website. https://github.com/dosco/super-graph/tree/master/docs/website/docs

from graphjin.

frederikhors avatar frederikhors commented on May 11, 2024

Yes I'll create a page in a few hours.

For this problem, can we use both string and int for user_id?

Here the code (https://github.com/dosco/super-graph/blob/master/core/args.go#L29-L36):

for i, p := range params {
  switch p.Name {
  case "user_id":
    if v := c.Value(UserIDKey); v != nil {
      vars[i] = v.(string) // maybe a case for int too?
    } else {
      return nil, argErr(p)
    }
...

from graphjin.

dosco avatar dosco commented on May 11, 2024

That should work.

from graphjin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.