I am an avid user of Go who loves how it makes my life so much easier due
to its amazing simplicity. I am thrilled to find that a great deal of
progress has been made in adding (simple) generic types and functions to
the language, which will make my life even simpler! When I discovered the
go2
Don't use fmt.Sprintf for the actual values, generate the positional
arguments yourself.
Something like:
q := "SELECT x FROM t WHERE y IN (%s)"
labelName := []string{'carnivore', 'mammal', 'vertebrate'}
var arrayArgs []string
for i := range labelName {
arrayArgs = append(arrayArgs, fmt.Sprint
here is a question I posted on dba.stackexchange:
https://dba.stackexchange.com/questions/282501/variable-number-of-arguments-with-golang
On Sun, Jan 3, 2021 at 2:20 PM Alexander Mills
wrote:
> labels are variable arguments, so I don't know how to do it..i solved it
> for the time being usin
labels are variable arguments, so I don't know how to do it..i solved it
for the time being using `fmt.Sprintf` but that leaves me vulnerable to sql
injection I suppose.
On Sun, Jan 3, 2021 at 8:58 AM 'Brian Candler' via golang-nuts <
golang-nuts@googlegroups.com> wrote:
> I think the nearest is
Hi there
If I got it right, all you wanna do is calculate the decibels of an audio
file and trigger an an alert in case it goes over a certain threshold.
I found this great answer on Stack overflow, really recommend the whole
read but I'll add here the TL;DR, however I do recommend the full read
I am able to open a wav file and iterate through samples of it. I am trying
to figure out the level of sound (loud vs low talking) and I believe it's a
matter of getting some value from the sample and then running some math
formulas.
Anyone have any ideas or references on this, prefer not some hea
I do believe (hope) David was kidding. Anonymous product types (and similar
constructs) are the root of all evil.
> On Jan 3, 2021, at 11:32 AM, roger peppe wrote:
>
> FWIW I'm certain that the lack of tuples in Go was a very deliberate decision
> - one of Go's more significant ancestors, Limb
FWIW I'm certain that the lack of tuples in Go was a very deliberate
decision - one of Go's more significant ancestors, Limbo, had tuples.
Anonymous product types have their disadvantages too (you don't get to name
the members, so code can end up significantly harder to understand), which
I suspect
I think the nearest is:
labelStrs := []interface{}{"carnivore", "mammal", "vertebrate"}
rows, err := c.Database.Db.Query(`
select id from mbk_user_label where label_name in (?,?,?)
`, labelStrs...)
Of course, you may need to change the number of question-marks to match
len(labelS
On Thu, Dec 31, 2020 at 9:45 PM da...@suarezhouse.net
wrote:
> Real use cases have been provided it appears for both why generics can be
> good and how they can be used negligently (love the sextuple example BTW).
Some future language will invent the idea that you should be able to create
anony
On Sun, Jan 03, 2021 at 12:53:03AM -0800, Alexander Mills wrote:
> rows, err := c.Database.Db.Query(`
>
> select *, (
> select count(*) from mbk_file_label
> where file_id = mbk_file.id and label_id IN (
> select id
> from mbk_user_label
> where label_name IN (
> $2
> )
> )
> ) as xxx
> fro
I have this:
rows, err := c.Database.Db.Query(`
select *, (
select count(*) from mbk_file_label
where file_id = mbk_file.id and label_id IN (
select id
from mbk_user_label
where label_name IN (
'carnivore', 'mammal', 'vertebrate'
)
)
) as xxx
from mbk_file
where user_id = $1
order by xxx DESC
`
12 matches
Mail list logo