Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Dec 08 16:41
    Coverage (release) -0.03%
  • Dec 08 16:27
    appleboy closed #2175
  • Dec 08 16:27
    appleboy commented #2175
  • Dec 08 16:19
    Coverage (AUG-6174) -0.05%
  • Dec 08 16:10
    codecov[bot] commented #2175
  • Dec 08 16:10
    codecov[bot] commented #2175
  • Dec 08 16:10
    codecov[bot] commented #2175
  • Dec 08 16:10
    Coverage (#2175) +0.00%
  • Dec 08 16:06
    hantmac opened #2175
  • Dec 08 15:52
    Coverage (AUG-6174) +0.06%
  • Dec 08 15:21
    appleboy milestoned #2173
  • Dec 08 15:21
    appleboy labeled #2173
  • Dec 08 15:00
    e3b0c442 edited #2174
  • Dec 08 15:00
    e3b0c442 opened #2174
  • Dec 08 14:36
    codecov[bot] commented #2173
  • Dec 08 14:35
    codecov[bot] commented #2173
  • Dec 08 14:35
    codecov[bot] commented #2173
  • Dec 08 14:35
    codecov[bot] commented #2173
  • Dec 08 14:35
    Coverage (#2173) -0.13%
  • Dec 08 14:31
    thinkerou opened #2173
Phillip Couto
@phillipCouto
@moos3 did you figure out HMAC?
DoctorNasa
@DoctorNasa
hi there
Ryan Luo
@Senmumu
hi there
Tiago Cardoso
@tiagoacardoso
Yo folks, is it possible to redirect a request to NoRoute handler?
Tiago Cardoso
@tiagoacardoso
any other way than use context Redirect to a route that doesn't exists?
Phillip Couto
@phillipCouto
@tiagoacardoso create the NoRoute handler as a separate function. Then in the code you want to redirect from just call your function and return to make sure nothing else runs.
Stefanos Chrs
@stefanoschrs
Hello, I have a question, is there any way to skip logging the 200 status requests? There is not much documentation on the logger middleware from what I searched. I'm looking for something like https://github.com/expressjs/morgan#skip
MZERO
@flymzero
test
MZERO
@flymzero
test
Phillip Couto
@phillipCouto
@stefanoschrs I would create a new router with a custom middle ware that checks status code and if not 200 passes the context to the logger:
I would provide a code sample but I can't from my device. If you want I can type one up later when i am on my laptop.
Gopher1980
@gopher1980
HI
I need your opinion of the my little module go for create CRUD on GORM. This module can work with mux or gingonic.
https://github.com/gopher1980/gormcrud
If you want help me, I will thank
Gopher1980
@gopher1980

other ide is use TableName
var suffix string

// Record is the one entity
type Record struct {
ID uint gorm:"primary_key" json:"id"
CreatedAt time.Time json:"created_at"
UpdatedAt time.Time json:"updated_at"
DeletedAt *time.Time json:"deleted_at"
Name string json:"name"
}

func (e Record) TableName() string {

return "record_" + suffix

}

and use suffix = "1"
db.AutoMigrate(&Record{})
suffix = "2"
db.AutoMigrate(&Record{})
I was wrong chat
Richard
@moos3
question, when using a logger middle ware like zerolog, how do I call it in my handlers when I want to log errors?
Rohit Roy Chowdhury
@roychowdhuryrohit-dev
How to validate if a json value was empty for a boolean field of a struct model?
John Napiorkowski
@jjn1056
I'm studying custom validation (https://gin-gonic.com/docs/examples/custom-validators/) and wondering if there's a best practice approach when you custom validation needs to access the database (for example to enforce uniqueness for a username, or require a password to be different than the last 3). Some examples I find via Google suggest just making the DB handler global and adding the SQL directly into the registered validation method. Does that seem like the approach to take? I'm still new to Golang and the idea of a global makes me itchy.
thanks for anything responses, thoughts.
John Napiorkowski
@jjn1056
a smaller question you might be able to answer, I can't seem to find online docs for the Gin API (for example c.ShouldBindWith). Is there an annotated API someplace or do you all just read the source code?
Riley J.
@the-rileyj
Reading the source code or using a search engine with the specific method is what I do
I am having issues with overwriting the 404 returned from NoRoute, I want it to be 200 and it will not set it correctly
Riley J.
@the-rileyj
nevermind, I got it figured out; I was writing the status after writing the content, which caused the 404. Writing the status first solved the problem
bugproof
@bugproof
is this benchmark accurate?
image.png
Joel Mislav Kunst
@7sedam7
hello, i have a more general golang question
Kaden Nelson
@KadenLNelson
func AWSSession() gin.HandlerFunc {
    return func(c *gin.Context) {
        session := session.Must(session.NewSession())

        c.Set("AWSSession", session)

        c.Next()
    }
}

I'm using using this middleware to add an aws session to the Gin context. The session doc reads

Sessions should be cached when possible, because creating a new Session will load all configuration values from the environment, and config files each time the Session is created.

Is there a better way to initialize this session instead of initializing it on each middleware/api call?

Bruce Wang
@BruceWangNo1

Hello everyone, my name is Yong Wang. And I am a graduate student from Sun Yat-sen University, China. I am about to graduate in June next year. So I have to work on my graduation project pretty soon. Some of my friends have already started. My supervisor is pretty open to what project I am into. I am proficient at Go. And I have a fair amount of working knowledge of API gateway from the github.com/fagongzi/gateway project and microservices when I was doing an internship at Tencent Games. I am looking to work on an open-source project where my work could eventually be concluded as my graduation thesis. There is one requirement which is that my work on the graduation project needs to have at least two novel approaches to some problems. Is it feasible? If so, would you please suggest some problems that I can work on?

Looking forward to your replies. Any feedbacks are welcome.

Sincerely,
Yong

Shaurya
@shaurya-xyz
Hi all, my name is shaurya, I was wondering if someone can explain to me how the validation of api calls made from client side once a user is authenticated. What I am trying to understand is given the backend is in go gin and the authentication system creates a session post login, user would have access to make api calls. Now in case of web app frontend which is opened in a browser would have the session assigned to it, wouldn't it be possible let's say by using a browser extension for rest api to query resources of a different user ? For example a query which returns notes of a user, with an endpoint /v1/mynotes with parameters userid can be manipulated of a different user and get all the notes ? How does this really work in real world applications ?
findridoy
@findridoy
Why gin engine not work outside function?
I tried it didn't work. Inside function it works.
Thanabodee Charoenpiriyakij
@wingyplus
@findridoy Could you provide an example?
Sean Murphy
@SeanFullstack
Hi, Sorry to bother you all on here - I have a golang contract position in Rotterdam,Holland 6 months paying up to £800 a day looking for strong developers who are interested - if you are interested please contact me on sean@fullstack.london or DM me to find out more.
Phillip Couto
@phillipCouto
@KadenLNelson yes, create it in server startup and use a custom middleware to pass it in to the gin.Context. This is what I do with my current projects.
@roychowdhuryrohit-dev make the field *bool and it will be null and test if the value after parsing is null in your code
Anmol Sethi
@nhooyr
Hello, could someone please review and merge gin-gonic/gin#2120 It's a very small fix.
DIII
@harishanumula
Hey Guys, I am new to Go, I want to develop Microservices for Go, I was overwhelmed with the number of frameworks available, if anyone has any comparisons or opinions that would be helpful.
Kai Blin
@kblin
hi folks
is there a way to create a reverse proxy middleware like described in gin-gonic/gin#686 that works on multiple paths, like a mux.Group?
I want to build an authentication wrapper that should wrap an existing API and handle logins and such. I'd like to proxy all requests to /api to the real API server
Kai Blin
@kblin
I'm currently doing something like apis := mux.Group("/api") apis.Use(NewReverseProxy())
The NewReverseProxy implementation sets up a handler func that logs something when it runs, but if I hit /api/ping, that log output doesn't appear, so I guess the middleware isn't being hit?
Alpaca Bi
@AlpacaBi
hi
sajjad kazemi
@sajjadkazemi10ss
hi
vegan2019
@vegan2019
Hello, new to gin . Wish you all a nice day
Frisk
@shanhuijie
son of bitch
mother fuck
Hi I'm jessy pinkman
Breaking Bad
Soul Goodman
bugproof
@bugproof
this gitter is dead