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

Golang mysql.Row类代码示例

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

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



在下文中一共展示了Row类的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: fillStruct

func fillStruct(row mysql.Row, sample reflect.Value, rowIndex int) {

	rowSize := len(row)
	// 遍历输入的结构体, 将每个类型的值缓冲地址存到scanparam中
	for i := 0; i < sample.NumField(); i++ {

		v := sample.Field(i)

		if i >= rowSize {
			log.Printf("out of row size, %d, rowsize: %d", i, rowSize)
			continue
		}

		//log.Println(i, rowIndex, row.Str(rowIndex))

		switch v.Kind() {
		case reflect.Int32, reflect.Uint32, reflect.Int64:
			v.SetInt(row.ForceInt64(rowIndex))
		case reflect.String:
			v.SetString(row.Str(rowIndex))
		case reflect.Struct:
			fillStruct(row, v, rowIndex)
		default:
			log.Printf("dbfw.makeScanParam unsupport type: %s", v.Type())
		}

		rowIndex++

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


示例5: 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


示例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: 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


示例8: 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


示例9: 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


示例10: 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


示例11: 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


示例12: 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


示例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: 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


示例15: 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


示例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: PopulateCustomer

func (c Customer) PopulateCustomer(row mysql.Row, res mysql.Result, ch chan Customer) {
	customer := Customer{
		ID:            row.Int(res.Map("cust_id")),
		Name:          row.Str(res.Map("name")),
		Email:         row.Str(res.Map("email")),
		Address:       row.Str(res.Map("address")),
		Address2:      row.Str(res.Map("address2")),
		City:          row.Str(res.Map("city")),
		StateID:       row.Int(res.Map("stateID")),
		PostalCode:    row.Str(res.Map("postal_code")),
		Phone:         row.Str(res.Map("phone")),
		Fax:           row.Str(res.Map("fax")),
		ContactPerson: row.Str(res.Map("contact_person")),
		DealerTypeID:  row.Int(res.Map("dealer_type")),
		Latitude:      row.Str(res.Map("latitude")),
		Longitude:     row.Str(res.Map("longitude")),
		Website:       row.Str(res.Map("website")),
		CustomerID:    row.Int(res.Map("customerID")),
		IsDummy:       row.Bool(res.Map("isDummy")),
		ParentID:      row.Int(res.Map("parentID")),
		SearchURL:     row.Str(res.Map("searchURL")),
		ELocalURL:     row.Str(res.Map("eLocalURL")),
		Logo:          row.Str(res.Map("logo")),
		MapicsCodeID:  row.Int(res.Map("mCodeID")),
		SalesRepID:    row.Int(res.Map("salesRepID")),
		APIKey:        row.Str(res.Map("APIKey")),
		Tier:          row.Int(res.Map("tier")),
		ShowWebsite:   row.Bool(res.Map("showWebsite")),
		LocationCount: row.Int(res.Map("locationCount")),
		UserCount:     row.Int(res.Map("userCount")),
		PropertyCount: row.Int(res.Map("propertyCount")),
	}

	ch <- customer
}
开发者ID:janiukjf,项目名称:GoAdmin,代码行数:35,代码来源:customer_mdl.go


示例18: PopulateNewsItem

func (n NewsItem) PopulateNewsItem(row mysql.Row, res mysql.Result, ch chan NewsItem) {
	item := NewsItem{
		ID:           row.Int(res.Map("newsItemID")),
		Title:        row.Str(res.Map("title")),
		Lead:         row.Str(res.Map("lead")),
		Content:      row.Str(res.Map("content")),
		PublishStart: row.Time(res.Map("publishStart"), UTC),
		PublishEnd:   row.Time(res.Map("publishEnd"), UTC),
		Active:       row.Bool(res.Map("active")),
		Slug:         row.Str(res.Map("slug")),
	}
	ch <- item
}
开发者ID:janiukjf,项目名称:GoAdmin,代码行数:13,代码来源:news_mdl.go


示例19: PopulateContent

func PopulateContent(row mysql.Row, res mysql.Result, ch chan Content) {
	cid := res.Map("contentID")
	contentType := res.Map("content_type")
	pageTitle := res.Map("page_title")
	createdDate := res.Map("createdDate")
	lastModified := res.Map("lastModified")
	metaTitle := res.Map("meta_title")
	metaDesc := res.Map("meta_description")
	keywords := res.Map("keywords")
	isPrimary := res.Map("isPrimary")
	published := res.Map("published")
	active := res.Map("active")
	slug := res.Map("slug")
	requireAuth := res.Map("requireAuthentication")
	canonical := res.Map("canonical")
	var content Content

	id := row.Int(cid)
	revCh := make(chan ContentRevisions)
	go GetContentRevisions(id, revCh)
	revisions := <-revCh
	content = Content{
		ID:              id,
		ContentType:     row.Str(contentType),
		PageTitle:       row.Str(pageTitle),
		CreatedDate:     row.Time(createdDate, UTC),
		LastModified:    row.Time(lastModified, UTC),
		MetaTitle:       row.Str(metaTitle),
		MetaDescription: row.Str(metaDesc),
		Keywords:        row.Str(keywords),
		Primary:         row.Bool(isPrimary),
		Published:       row.Bool(published),
		Active:          row.Bool(active),
		Slug:            row.Str(slug),
		RequireAuth:     row.Bool(requireAuth),
		Canonical:       row.Str(canonical),
		Revisions:       revisions,
		ActiveRevision:  revisions.GetActiveRevision(),
	}
	ch <- content
}
开发者ID:janiukjf,项目名称:GoAdmin,代码行数:41,代码来源:sitecontent_mdl.go


示例20: PopulateUser

func (c CustomerUser) PopulateUser(row mysql.Row, res mysql.Result, ch chan CustomerUser) {
	user := CustomerUser{
		ID:          row.Str(res.Map("id")),
		CustID:      row.Int(res.Map("cust_ID")),
		CustomerID:  row.Int(res.Map("customerID")),
		Name:        row.Str(res.Map("name")),
		Email:       row.Str(res.Map("email")),
		DateAdded:   row.Time(res.Map("date_added"), UTC),
		Active:      row.Bool(res.Map("active")),
		LocationID:  row.Int(res.Map("locationID")),
		IsSudo:      row.Bool(res.Map("isSudo")),
		NotCustomer: row.Bool(res.Map("NotCustomer")),
	}
	ch <- user
}
开发者ID:janiukjf,项目名称:GoAdmin,代码行数:15,代码来源:customeruser_mdl.go



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Golang mysql.Transaction类代码示例发布时间:2022-05-28
下一篇:
Golang mysql.Result类代码示例发布时间: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