• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Golang mysql.Result类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Golang中github.com/ziutek/mymysql/mysql.Result的典型用法代码示例。如果您正苦于以下问题:Golang Result类的具体用法?Golang Result怎么用?Golang Result使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Result类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
}
开发者ID:janiukjf,项目名称:GoAdmin,代码行数:7,代码来源:contact_mdl.go


示例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
}
开发者ID:janiukjf,项目名称:GoAdmin,代码行数:8,代码来源:customer_mdl.go


示例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
}
开发者ID:janiukjf,项目名称:GoAdmin,代码行数:8,代码来源:location_mdl.go


示例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
}
开发者ID:janiukjf,项目名称:GoAdmin,代码行数:10,代码来源:customer_mdl.go


示例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
}
开发者ID:janiukjf,项目名称:GoAdmin,代码行数:10,代码来源:customer_mdl.go


示例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
}
开发者ID:janiukjf,项目名称:GoAdmin,代码行数:9,代码来源:landingpage_mdl.go


示例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
}
开发者ID:janiukjf,项目名称:GoAdmin,代码行数:9,代码来源:landingpage_mdl.go


示例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
}
开发者ID:janiukjf,项目名称:GoAdmin,代码行数:9,代码来源:location_mdl.go


示例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("}")
}
开发者ID:abualsamid,项目名称:tinyblog,代码行数:47,代码来源:mapper.go


示例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
}
开发者ID:janiukjf,项目名称:GoAdmin,代码行数:10,代码来源:contact_mdl.go


示例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
		}
	}
}
开发者ID:chogaths,项目名称:robin,代码行数:18,代码来源:dbexec.go


示例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
}
开发者ID:janiukjf,项目名称:GoAdmin,代码行数:19,代码来源:sitecontent_mdl.go


示例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
}
开发者ID:janiukjf,项目名称:GoAdmin,代码行数:8,代码来源:faq_mdl.go


示例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
}
开发者ID:janiukjf,项目名称:GoAdmin,代码行数:8,代码来源:customer_mdl.go


示例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
}
开发者ID:janiukjf,项目名称:GoAdmin,代码行数:9,代码来源:customer_mdl.go


示例16: PopulateSalesRep

func (s SalesRep) PopulateSalesRep(row mysql.Row, res mysql.Result, ch chan SalesRep) {
	rep := SalesRep{
		ID:            row.Int(res.Map("salesRepID")),
		Name:          row.Str(res.Map("name")),
		Code:          row.Str(res.Map("code")),
		CustomerCount: row.Int(res.Map("customercount")),
	}
	ch <- rep
}
开发者ID:janiukjf,项目名称:GoAdmin,代码行数:9,代码来源:salesreps_mdl.go


示例17: PopulateCategory

func (c BlogCategory) PopulateCategory(row mysql.Row, res mysql.Result, ch chan BlogCategory) {
	category := BlogCategory{
		ID:     row.Int(res.Map("blogCategoryID")),
		Name:   row.Str(res.Map("name")),
		Slug:   row.Str(res.Map("slug")),
		Active: row.Bool(res.Map("active")),
	}
	ch <- category
}
开发者ID:janiukjf,项目名称:GoAdmin,代码行数:9,代码来源:blog_mdl.go


示例18: PopulateTestimonial

func (t Testimonial) PopulateTestimonial(row mysql.Row, res mysql.Result, ch chan Testimonial) {
	testimonial := Testimonial{
		ID:        row.Int(res.Map("testimonialID")),
		Rating:    row.Float(res.Map("rating")),
		Title:     row.Str(res.Map("title")),
		Content:   row.Str(res.Map("testimonial")),
		DateAdded: row.Time(res.Map("dateAdded"), UTC),
		Approved:  row.Bool(res.Map("approved")),
		Active:    row.Bool(res.Map("active")),
		FirstName: row.Str(res.Map("first_name")),
		LastName:  row.Str(res.Map("last_name")),
		Location:  row.Str(res.Map("location")),
	}
	ch <- testimonial
}
开发者ID:janiukjf,项目名称:GoAdmin,代码行数:15,代码来源:testimonial_mdl.go


示例19: PopulateContact

func (c Contact) PopulateContact(row mysql.Row, res mysql.Result, ch chan Contact) {
	contact := Contact{
		ID:         row.Int(res.Map("contactID")),
		FirstName:  row.Str(res.Map("first_name")),
		LastName:   row.Str(res.Map("last_name")),
		Email:      row.Str(res.Map("email")),
		Phone:      row.Str(res.Map("phone")),
		Subject:    row.Str(res.Map("subject")),
		Message:    row.Str(res.Map("message")),
		Created:    row.Time(res.Map("createdDate"), UTC),
		Type:       row.Str(res.Map("type")),
		Address1:   row.Str(res.Map("address1")),
		Address2:   row.Str(res.Map("address2")),
		City:       row.Str(res.Map("city")),
		PostalCode: row.Str(res.Map("postalcode")),
		Country:    row.Str(res.Map("country")),
	}
	ch <- contact
}
开发者ID:janiukjf,项目名称:GoAdmin,代码行数:19,代码来源:contact_mdl.go


示例20: PopulateVideo

func (v Video) PopulateVideo(row mysql.Row, res mysql.Result, ch chan Video) {
	video := Video{
		ID:          row.Int(res.Map("videoID")),
		EmbedLink:   row.Str(res.Map("embed_link")),
		DateAdded:   row.Time(res.Map("dateAdded"), UTC),
		Sort:        row.Int(res.Map("sort")),
		Title:       row.Str(res.Map("title")),
		Description: row.Str(res.Map("description")),
		YouTubeID:   row.Str(res.Map("youtubeID")),
		WatchPage:   row.Str(res.Map("watchpage")),
		Screenshot:  row.Str(res.Map("screenshot")),
	}
	ch <- video
}
开发者ID:janiukjf,项目名称:GoAdmin,代码行数:14,代码来源:video_mdl.go



注:本文中的github.com/ziutek/mymysql/mysql.Result类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang mysql.Row类代码示例发布时间:2022-05-28
下一篇:
Golang mysql.Error类代码示例发布时间:2022-05-28
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap