当前位置: 首页>>代码示例>>Golang>>正文


Golang mysql.Row类代码示例

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


在下文中一共展示了Row类的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
}
开发者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


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