channel.go
470 Bytes
package models
import (
"database/sql"
db "client/icesimba.ad/database"
)
type Channel struct {
Id int64
}
type channel struct {
Id sql.NullInt64
}
func QueryChannelByName(name string) (out Channel, err error) {
sqlQu := "select channel_id from ice_channel where channel_name=?"
chanNull := channel{}
err = db.SqlDB.QueryRow(sqlQu, name).Scan(
&chanNull.Id,
)
if err != nil {
return
}
if chanNull.Id.Valid {
out.Id = chanNull.Id.Int64
}
return
}