fix query error
This commit is contained in:
parent
c233fa0cfb
commit
c6e0ada3f7
@ -17,7 +17,7 @@ type Lottery struct {
|
|||||||
// GetRandomLotteryByType -
|
// GetRandomLotteryByType -
|
||||||
func GetRandomLotteryByType(t string) (p *Lottery, err error) {
|
func GetRandomLotteryByType(t string) (p *Lottery, err error) {
|
||||||
p = &Lottery{}
|
p = &Lottery{}
|
||||||
err = x.Get(p, `select * from "public"."lottery" where "type" = $1 order random() limit 1`, t)
|
err = x.Get(p, `select * from "public"."lottery" where "type" = $1 order by random() limit 1`, t)
|
||||||
if err == sql.ErrNoRows {
|
if err == sql.ErrNoRows {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user