ad.go
448 Bytes
package models
import (
"database/sql"
db "client/icesimba.ad/database"
)
type Ad struct {
AppId string
}
type ad struct {
AppId sql.NullString
}
func QueryAdById(adId string) (out Ad, err error) {
sqlQu := "select ad_app from ice_ad where ad_id=? limit 1"
adNull := ad{}
err = db.SqlDB.QueryRow(sqlQu, adId).Scan(
&adNull.AppId,
)
if err != nil {
return
}
if adNull.AppId.Valid {
out.AppId = adNull.AppId.String
}
return
}