[go-nuts] max connections limit lib/pq
I am running into an issue I have seen mentioned on here years ago. I am seeking the current best solution. I have a web server connecting to a postgresql database using the standard database/sql and the lib/pq driver. I keep running out of connections over time as it seems the pool grows up to 100. Is there a way to prevent or fix this? Best regards, Ty -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[go-nuts] Re: Golang, SQL and ORM avoidance techniques
I had the same line of thinking regarding avoiding an ORM. I settled on using sqlx for my project. On Friday, June 2, 2017 at 8:55:12 AM UTC-4, brylant wrote: > > > I've been trying hard (well.. as much as I can considering my lack of > in-depth go knowledge or - to be perfectly honest - lack of in-depth > knowledge of anything) to find suitable go+sql technique that would not > require a lot of code repetition, not use reflection and not use ORMs of > any sort... Could somebody please tell me if there's anything particularly > wrong with the following: > > > type ScannerFunc func() []interface{} > > func (db *DB) ScanSome(stmt string, sf ScannerFunc, params ...interface{}) > error { > rows, err := db.Query(stmt, params...) > if err != nil { > return err > } > defer rows.Close() > for rows.Next() { > err = rows.Scan(sf()...) > if err != nil { > return err > } > } > if err = rows.Err(); err != nil { > return err > } > return nil > } > > Having the above I could then implement the following for each of my > 'models' (User being an example below). This could easily be 'go > generate'-d for each model > > > type User struct { > UserID int64 > Namestring > Roleint > // (...) > } > > func ScanUsersFunc(users *[]*User) ScannerFunc { > return ScannerFunc(func() []interface{}) { > u := User{} > *users = append(*users, ) > var r []interface{} = []interface{}{, , , > (more > properties)} > return r > } > } > > > and finally use it like this: > > > const ( > sqlUsersByRole = "SELECT user_id,name,role, (more if needed) FROM > user WHERE role=?" > sqlAllUsers= "SELECT user_id,name,role FROM user" > ) > > func (db *DB) UsersByRole(role int) ([]*User, error) { > users := make([]*User, 0) > err := db.ScanSome(sqlUsersByRole, ScanUsersFunc(), role) > if err != nil { > return nil, err > } > return users, nil > } > > func (db *DB) AllUsers() ([]*User, error) { > users := make([]*User, 0) > err := db.ScanSome(sqlAllUsers, ScanUsersFunc()) > if err != nil { > return nil, err > } > return users, nil > } > > > Alternatively (to avoid scanning/returning all results) a callback could > be provided to ScanSome and called after each scan. > > Obviously I could also implement ScanOne for situations where I only > expect one row of results... > > > So - any obvious issues with the above 'technique'...? > > > Thanks, > > adam > > > > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[go-nuts] Embedding SWI Prolog in Go
I am curious if there are any projects out there that have embedded a SWI Prolog engine in Go via cgo? Best regards, Ty -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[go-nuts] Re: nested template question
thanks Billie, I will check it out On Wednesday, May 17, 2017 at 1:56:46 PM UTC-4, Billie H Cleek wrote: > > Ty, > > The block template can satisfy your need: > https://godoc.org/text/template#example-Template--Block > > On Wednesday, May 17, 2017 at 4:55:28 AM UTC-7, Tieson Molly wrote: >> >> Is there a way to defined a template name as a fallback if one does not >> exist? >> >> Say you have a nested template in your code >> >> {{template "javascript" .}} >> >> >> if the template name "javascript" is not defined because you did not >> include that file during the parsing, is there a way to >> >> generate that name dynamically? >> >> Best regards, >> >> Ty >> > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[go-nuts] nested template question
Is there a way to defined a template name as a fallback if one does not exist? Say you have a nested template in your code {{template "javascript" .}} if the template name "javascript" is not defined because you did not include that file during the parsing, is there a way to generate that name dynamically? Best regards, Ty -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[go-nuts] Re: How to do OS Authentication in Oracle with Go?
Tamás, this is great news. Thank you -Ty On Wednesday, April 26, 2017 at 4:22:01 PM UTC-4, Tamás Gulácsi wrote: > > > > 2017. április 25., kedd 21:46:27 UTC+2 időpontban Tieson Molly a > következőt írta: >> >> Tamás, I was looking for a way to have the OS handle the authentication >> for the Oracle connection. That is one of the options where you pass an >> empty username and password. Didier provided a detailed link from Oracle. >> > > I've checked, and rana/ora defaults to OCI_CRED_EXT/OCI_SESSGET_CREDEXT if > username == "" && password == "" (/@sid). > > So, just try it :) > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[go-nuts] How to do OS Authentication in Oracle with Go?
I am curious if anyone is connecting to an Oracle database using OS authentication on a linux platform? I have been trying to find code or an example, but I have come up empty handed. Best regards, Ty -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[go-nuts] Re: scriptable rules?
I think I answered my own question https://github.com/AdamJonR/dialects On Friday, March 10, 2017 at 10:41:04 AM UTC-5, Tieson Molly wrote: > > > > Thanks Ben, is it this one? > > https://github.com/robertkrimen/otto > > Are there any projects for creating DSLs in Go? > > On Friday, March 10, 2017 at 9:28:22 AM UTC-5, Ben B wrote: >> >> Otto seems popular for running javascript inside a native Go VM. >> >> On Thursday, 9 March 2017 16:28:42 UTC, Tieson Molly wrote: >>> >>> Are there any good libraries or packages to >>> handle complex rule sets dynamically? >>> >>> I was thinking either some sort of embedded Prolog in Go >>> or maybe Lua, but maybe someone knows of something simpler? >>> >>> Best regards, >>> >>> Ty >>> >> -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[go-nuts] Re: scriptable rules?
Thanks Ben, is it this one? https://github.com/robertkrimen/otto Are there any projects for creating DSLs in Go? On Friday, March 10, 2017 at 9:28:22 AM UTC-5, Ben B wrote: > > Otto seems popular for running javascript inside a native Go VM. > > On Thursday, 9 March 2017 16:28:42 UTC, Tieson Molly wrote: >> >> Are there any good libraries or packages to >> handle complex rule sets dynamically? >> >> I was thinking either some sort of embedded Prolog in Go >> or maybe Lua, but maybe someone knows of something simpler? >> >> Best regards, >> >> Ty >> > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[go-nuts] scriptable rules?
Are there any good libraries or packages to handle complex rule sets dynamically? I was thinking either some sort of embedded Prolog in Go or maybe Lua, but maybe someone knows of something simpler? Best regards, Ty -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[go-nuts] question on golang.org/x/crypto/acme/autocert
I am looking for some examples for golang.org/x/crypto/acme/autocert I recently updated my server, and there are some openssl version issues with the letsencrypt certbot that I cannot resolve. I was hoping to find a Go based solution so I could skip these python dependency issues. The ideal solution would download a new cert to a specified directory. Best regards, Ty -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[go-nuts] How has your company adopted Go ?
What arguments or factors have contributed to your company adopting Go? Many businesses see switching to a new language or even using a new language side by side with their existing language choice as a business risk. Best regards, Ty -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[go-nuts] Deleting the /r/golang subreddit
I personally like the /r/golang subreddit for finding new projects or blog posts related to Go. I prefer Google groups for more discussion. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[go-nuts] question on profiling and instruction count display
Is there a way to use the native pprof tool to display the instruction count based on the sample instead of the duration for a cpu profile? I saw this post on SO, but I was hoping to be able to use pprof and not a 3rd party tool http://stackoverflow.com/questions/28924550/golang-profile-with-pprof-how-to-get-hit-count-not-duration I also saw a recent mention of the instruction cost here for the callgrind format https://groups.google.com/forum/#!msg/golang-codereviews/CVOeJ4QF8C8/-Q9_B48dAwAJ Best regards, Ty -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [go-nuts] filtering and forwarding email?
could you recommend a good POP3 library? Best regards, Ty On Friday, September 16, 2016 at 10:16:39 AM UTC-4, Shawn Milochik wrote: > > Sure, all you need is the ability to send and receive e-mail. Then you > write your filtering logic. > > https://github.com/go-gomail/gomail > > This will take care of the heavy lifting. > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[go-nuts] filtering and forwarding email?
Are there any email projects in Go that can act as a email filter where the client would pull email down from the an account and based upon some rules forward the email. Best regards, Ty -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[go-nuts] Re: job queue with the ability to kill worker processes
Thanks Jason, I was looking for something to handle external processes. On Monday, September 5, 2016 at 11:13:59 AM UTC-4, Jason E. Aten wrote: > > On Thursday, September 1, 2016 at 4:40:50 AM UTC-7, Tieson Molly wrote: >> >> Are there any go projects that implement a queue where workers that >> consume the queue could be tracked and potentially killed if the end user >> decides to cancel the job? >> > > I assume you mean across multiple worker processes; possibly all on one > host or possibly in a distributed fashion. My goq project, pronounced "go > queue", > > https://github.com/glycerine/goq > > let's you cancel a job, using "goq kill ". Workers that were > started with "goq work" will die after oneshot at work. Workers that were > started with "goq work forever" will keep requesting jobs. > > If you mean within a single process, this is common and readily > implemented using channels. The stdlib's "net/context" has even > standardized an interface to such requests. I'll keep this short. Feel free > to let me know if you meant in-process and need more detail. > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[go-nuts] Re: Go performance in regexdna
I looked at the C version, and it looks like it actually uses the TCL regex library that has some slightly different characteristics than the PCRE library. On Thursday, September 1, 2016 at 4:34:41 PM UTC-4, DrGo wrote: > > What is the reason for Go particularly poor performance in regexdna as > shown here? > https://benchmarksgame.alioth.debian.org/u64q/performance.php?test=regexdna > Cheers -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[go-nuts] job queue with the ability to kill worker processes
Are there any go projects that implement a queue where workers that consume the queue could be tracked and potentially killed if the end user decides to cancel the job? Best regards, Ty -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.