本文整理汇总了Golang中github.com/ziutek/mymysql/mysql.Result类的典型用法代码示例。如果您正苦于以下问题:Golang Result类的具体用法?Golang Result怎么用?Golang Result使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Result类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: PopulateContactType
func PopulateContactType(row mysql.Row, res mysql.Result, ch chan ContactType) {
ctype := ContactType{
ID: row.Int(res.Map("contactTypeID")),
Name: row.Str(res.Map("name")),
}
ch <- ctype
}
示例2: PopulateTier
func (d DealerTier) PopulateTier(row mysql.Row, res mysql.Result, ch chan DealerTier) {
tier := DealerTier{
ID: row.Int(res.Map("ID")),
Name: row.Str(res.Map("tier")),
Sort: row.Int(res.Map("sort")),
}
ch <- tier
}
示例3: PopulateCountry
func (c Country) PopulateCountry(row mysql.Row, res mysql.Result, ch chan Country) {
country := Country{
ID: row.Int(res.Map("countryID")),
Name: row.Str(res.Map("name")),
Abbr: row.Str(res.Map("abbr")),
}
ch <- country
}
示例4: PopulateType
func (d DealerType) PopulateType(row mysql.Row, res mysql.Result, ch chan DealerType) {
dealertype := DealerType{
ID: row.Int(res.Map("dealer_type")),
Name: row.Str(res.Map("type")),
Online: row.Bool(res.Map("online")),
Show: row.Bool(res.Map("show")),
Label: row.Str(res.Map("label")),
}
ch <- dealertype
}
示例5: PopulateIcon
func (m MapIcon) PopulateIcon(row mysql.Row, res mysql.Result, ch chan MapIcon) {
icon := MapIcon{
ID: row.Int(res.Map("ID")),
DealerTierID: row.Int(res.Map("tier")),
DealerTypeID: row.Int(res.Map("dealer_type")),
MapIcon: row.Str(res.Map("mapicon")),
MapIconShadow: row.Str(res.Map("mapiconshadow")),
}
ch <- icon
}
示例6: populateLandingPageImage
func (l LandingPage) populateLandingPageImage(row mysql.Row, res mysql.Result, ch chan LandingPageImage) {
image := LandingPageImage{
ID: row.Int(res.Map("id")),
LandingPageID: row.Int(res.Map("landingPageID")),
URL: row.Str(res.Map("url")),
Sort: row.Int(res.Map("sort")),
}
ch <- image
}
示例7: populateLandingPageData
func (l LandingPage) populateLandingPageData(row mysql.Row, res mysql.Result, ch chan LandingPageData) {
data := LandingPageData{
ID: row.Int(res.Map("id")),
LandingPageID: row.Int(res.Map("landingPageID")),
Key: row.Str(res.Map("dataKey")),
Value: row.Str(res.Map("dataValue")),
}
ch <- data
}
示例8: PopulateState
func (s State) PopulateState(row mysql.Row, res mysql.Result, ch chan State) {
state := State{
ID: row.Int(res.Map("stateID")),
CountryID: row.Int(res.Map("countryID")),
Name: row.Str(res.Map("state")),
Abbr: row.Str(res.Map("abbr")),
}
ch <- state
}
示例9: GenerateStructure
// GenerateStructure generates the GO struct from a MySQL Result set
func GenerateStructure(res mysql.Result, structName string) {
fmt.Printf("type %s struct {\n", structName)
for _, field := range res.Fields() {
fmt.Printf("\t%s", strings.Title(field.Name))
switch field.Type {
default:
fmt.Printf("\t%s\t`db:\"%s\" json:\"%s\"`\n", "string", field.Name, field.Name)
case MYSQL_TYPE_STRING, MYSQL_TYPE_VAR_STRING, MYSQL_TYPE_VARCHAR,
MYSQL_TYPE_BLOB, MYSQL_TYPE_TINY_BLOB,
MYSQL_TYPE_MEDIUM_BLOB, MYSQL_TYPE_LONG_BLOB, MYSQL_TYPE_SET,
MYSQL_TYPE_ENUM, MYSQL_TYPE_GEOMETRY:
fmt.Printf("\t%s\t`db:\"%s\" json:\"%s\"`\n", "string", field.Name, field.Name)
case MYSQL_TYPE_BIT:
fmt.Printf("\t%s\t`db:\"%s\" json:\"%s\"`\n", "bool", field.Name, field.Name)
case MYSQL_TYPE_TINY, MYSQL_TYPE_SHORT, MYSQL_TYPE_YEAR, MYSQL_TYPE_LONG, MYSQL_TYPE_INT24:
fmt.Printf("\t%s\t`db:\"%s\" json:\"%s\"`\n", "int", field.Name, field.Name)
case MYSQL_TYPE_LONGLONG:
fmt.Printf("\t%s\t`db:\"%s\" json:\"%s\"`\n", "uint64", field.Name, field.Name)
case MYSQL_TYPE_FLOAT:
fmt.Printf("\t%s\t`db:\"%s\" json:\"%s\"`\n", "float64", field.Name, field.Name)
case MYSQL_TYPE_DOUBLE:
fmt.Printf("\t%s\t`db:\"%s\" json:\"%s\"`\n", "float64", field.Name, field.Name)
case MYSQL_TYPE_DECIMAL, MYSQL_TYPE_NEWDECIMAL:
fmt.Printf("\t%s\t`db:\"%s\" json:\"%s\"`\n", "decimal.Decimal", field.Name, field.Name)
case MYSQL_TYPE_DATE, MYSQL_TYPE_NEWDATE:
fmt.Printf("\t%s\t`db:\"%s\" json:\"%s\"`\n", "time.Time", field.Name, field.Name)
case MYSQL_TYPE_DATETIME, MYSQL_TYPE_TIMESTAMP:
fmt.Printf("\t%s\t`db:\"%s\" json:\"%s\"`\n", "time.Time", field.Name, field.Name)
case MYSQL_TYPE_TIME:
fmt.Printf("\t%s\t`db:\"%s\" json:\"%s\"`\n", "time.Duration", field.Name, field.Name)
}
}
fmt.Println("}")
}
示例10: PopulateContactReceiver
func (r ContactReceiver) PopulateContactReceiver(row mysql.Row, res mysql.Result, ch chan ContactReceiver) {
receiver := ContactReceiver{
ID: row.Int(res.Map("contactReceiverID")),
FirstName: row.Str(res.Map("first_name")),
LastName: row.Str(res.Map("last_name")),
Email: row.Str(res.Map("email")),
}
receiver.GetTypes()
ch <- receiver
}
示例11: eatResult
func eatResult(res mysql.Result) {
for {
res, err := res.NextResult()
if err != nil {
log.Printf("%s", err)
continue
}
if res == nil {
break
}
if res.StatusOnly() {
break
}
}
}
示例12: PopulateRevision
func PopulateRevision(row mysql.Row, res mysql.Result, ch chan ContentRevision) {
var revision ContentRevision
id := res.Map("revisionID")
contentID := res.Map("contentID")
contentText := res.Map("content_text")
createdOn := res.Map("createdOn")
active := res.Map("active")
revision = ContentRevision{
ID: row.Int(id),
ContentID: row.Int(contentID),
ContentText: row.Str(contentText),
CreatedOn: row.Time(createdOn, UTC),
Active: row.Bool(active),
}
ch <- revision
}
示例13: PopulateFAQ
func (f *FAQ) PopulateFAQ(row mysql.Row, res mysql.Result, ch chan FAQ) {
faq := FAQ{
ID: row.Int(res.Map("faqID")),
Question: row.Str(res.Map("question")),
Answer: row.Str(res.Map("answer")),
}
ch <- faq
}
示例14: PopulateCode
func (m MapicsCode) PopulateCode(row mysql.Row, res mysql.Result, ch chan MapicsCode) {
code := MapicsCode{
ID: row.Int(res.Map("mCodeID")),
Code: row.Str(res.Map("code")),
Description: row.Str(res.Map("description")),
}
ch <- code
}
示例15: PopulateSimpleCustomer
func (c Customer) PopulateSimpleCustomer(row mysql.Row, res mysql.Result, ch chan Customer) {
customer := Customer{
ID: row.Int(res.Map("cust_id")),
Name: row.Str(res.Map("name")),
CustomerID: row.Int(res.Map("customerID")),
}
ch <- customer
}