Re: [go-nuts] Go is easy to lean. But other languages are hard to forget

2020-10-05 Thread Andy Hall
thankfully I chose to learn go as my first language...so all good then :-) On Monday, October 5, 2020 at 10:23:32 AM UTC+1 era...@gmail.com wrote: > I believe all these are statements of facts based on practical > observations that one finds out that to learn GO one needs to unlearn and > then

Re: [go-nuts] handling database.Query empty set

2020-09-13 Thread Andy Hall
over and read compared to most other languages. i hope this tip > might help you answer other questions yourself as well. > > have fun! > > On 13.09.20 10:19, Andy Hall wrote: > > thanks martin...it seems with no query handling the database Next func > > does not run any

Re: [go-nuts] handling database.Query empty set

2020-09-13 Thread Andy Hall
eed the results scanned into a go slice, consider > using query row with a sql select count(*) … query and scan, then check > the resulting integer. > > have fun! > > On 12.09.20 21:16, Andy Hall wrote: > > the database.Query func does not return ErrNoRows unlike the > >

Re: [go-nuts] writing to net.Conn tcp socket

2020-09-12 Thread Andy Hall
project and go back to the docs as you suggest rather than ploughing through every problem I come across...as fun as that can be. On Saturday, September 12, 2020 at 8:02:31 PM UTC+1 b.ca...@pobox.com wrote: > On Saturday, 12 September 2020 19:36:18 UTC+1, Andy Hall wrote: >> >> to h

[go-nuts] handling database.Query empty set

2020-09-12 Thread Andy Hall
the database.Query func does not return ErrNoRows unlike the database.QueryRow func so how to I handle an empty set when I wish to run a query which returns multiple rows... // tell other players in the room you have entered rows_users, err := database.Query("SELECT username FROM users WHERE roo

Re: [go-nuts] writing to net.Conn tcp socket

2020-09-12 Thread Andy Hall
hen testing the map ? On Sat, 12 Sep 2020 at 18:33, Andy Hall wrote: > > thanks brian...I have looked at sync / channels but I think the > simplicity of mutex should work fine for me. > > On Sat, 12 Sep 2020 at 18:13, Brian Candler wrote: > > > > On Saturday, 1

Re: [go-nuts] writing to net.Conn tcp socket

2020-09-12 Thread Andy Hall
thanks brian...I have looked at sync / channels but I think the simplicity of mutex should work fine for me. On Sat, 12 Sep 2020 at 18:13, Brian Candler wrote: > > On Saturday, 12 September 2020 17:04:19 UTC+1, mb0 wrote: >> >> a global map is the way to go, however writing an reading the map fro

Re: [go-nuts] writing to net.Conn tcp socket

2020-09-12 Thread Andy Hall
ay it is usually solved is by adding another > sync.Mutex (mutually exclusive) variable to ensure only one go routine at a > has access to the map. > > https://godoc.org/sync#Mutex > > just a heads up, have fun! > > On 9/12/20 2:46 PM, Andy Hall wrote: > > OK so I

Re: [go-nuts] writing to net.Conn tcp socket

2020-09-12 Thread Andy Hall
OK so I just moved the declaration of the map to the package itself which makes it universal...all working as expected. Thanks. On Saturday, September 12, 2020 at 1:35:49 PM UTC+1 Andy Hall wrote: > So this works fine... > > func handleConnection(c net.Conn) { > // get user detail

Re: [go-nuts] writing to net.Conn tcp socket

2020-09-12 Thread Andy Hall
is outside of a goroutine... On Saturday, September 12, 2020 at 7:55:34 AM UTC+1 Andy Hall wrote: > I think this is exactly what I need to do...thanks very much. I'm looking > forward to implementing it. > > On Saturday, September 12, 2020 at 5:43:09 AM UTC+1 Shulhan wrote: > >

Re: [go-nuts] writing to net.Conn tcp socket

2020-09-11 Thread Andy Hall
I think this is exactly what I need to do...thanks very much. I'm looking forward to implementing it. On Saturday, September 12, 2020 at 5:43:09 AM UTC+1 Shulhan wrote: > > > Pada tanggal Sab, 12 Sep 2020 02.54, Andy Hall > menulis: > >> if I have multiple clients

[go-nuts] writing to net.Conn tcp socket

2020-09-11 Thread Andy Hall
if I have multiple clients connected to a tcp server and I wish to write back to specific connections I can record the net.Conn value and then use the Write method on it...but when using Println I get the following for two clients... &{{0xc94000}} &{{0xc94080}} which when testing with