當前位置: 首頁>>代碼示例>>Golang>>正文


Golang df.List類代碼示例

本文整理匯總了Golang中github.com/mikeshimura/dbflute/df.List的典型用法代碼示例。如果您正苦於以下問題:Golang List類的具體用法?Golang List怎麽用?Golang List使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了List類的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: ReplacePageTotal

func (r *GoReport) ReplacePageTotal() {
	if r.PageTotal == false {
		return
	}
	lines := strings.Split(r.Converter.Text, "\n")
	list := new(df.List)
	for i, line := range lines {
		if len(line) < 8 {
			continue
		}
		if line[0:7] == "v\tPAGE\t" {
			h := new(pagehist)
			h.line = i
			h.page = AtoiPanic(line[7:])
			list.Add(h)
			//fmt.Printf("hist %v \n", h)
		}
	}
	for i, line := range lines {
		if strings.Index(line, "{#TotalPage#}") > -1 {
			total := r.getTotalPage(i, list)
			//fmt.Printf("total :%v\n", total)
			lines[i] = strings.Replace(lines[i], "{#TotalPage#}", strconv.Itoa(total), -1)
		}
	}
	buf := new(bytes.Buffer)
	for _, line := range lines {
		buf.WriteString(line + "\n")
	}
	r.Converter.Text = buf.String()
}
開發者ID:suzuken,項目名稱:goreport,代碼行數:31,代碼來源:goreport.go

示例2: Transaction

func (p *Customer) Transaction(transactions []interface{}) {
	transactionResult := new(df.List)
	for _, transaction := range transactions {
		var tran map[string]interface{} = transaction.(map[string]interface{})
		res := p.executeEachTransaction(tran)
		transactionResult.Add(res)
	}
	p.context.JSON(200, dfweb.SetNormalFetchResult(transactionResult))
}
開發者ID:mikeshimura,項目名稱:go-dbflute-example,代碼行數:9,代碼來源:customer.go

示例3: GetDbs

func (p *SysTable) GetDbs() {
	cbx := cb.CreateSysTableCB()
	cbx.Query().SetDelFlag_Equal(0)
	cbx.Query().SetTableName_Equal("DbName")
	cbx.Query().AddOrderBy_Key1_Asc()
	res, err := bhv.SysTableBhv_I.SelectList(cbx, p.tx)
	if err != nil {
		panic(err.Error())
	}
	reslist := new(df.List)
	for _, ent := range res.List.GetAsArray() {
		entx := ent.(*entity.SysTable)
		cmap := make(map[string]string)
		cmap["value"] = entx.GetKey1()
		cmap["label"] = entx.GetKey1()
		reslist.Add(cmap)
	}
	p.context.JSON(200, dfweb.SetNormalFetchResult(reslist))
}
開發者ID:mikeshimura,項目名稱:go-dbflute-example,代碼行數:19,代碼來源:sysTable.go

示例4: getSecData

func (p *Employee) getSecData() {
	cbx := cb.CreateUserTableCB()
	cbx.Query().SetDelFlag_Equal(0)
	cbx.Query().SetTableName_Equal("section")
	cbx.Query().AddOrderBy_Key1_Asc()
	res, err := bhv.UserTableBhv_I.SelectList(cbx, p.tx)
	if err != nil {
		panic(err.Error())
	}
	reslist := new(df.List)
	cmap := make(map[string]interface{})
	cmap["value"] = 0
	cmap["label"] = ""
	reslist.Add(cmap)
	for _, ent := range res.List.GetAsArray() {
		entx := ent.(*entity.UserTable)
		cmap := make(map[string]interface{})
		cmap["value"] = entx.GetId()
		cmap["label"] = entx.GetS1Data().String
		reslist.Add(cmap)
	}
	p.context.JSON(200, dfweb.SetNormalFetchResult(reslist))
}
開發者ID:mikeshimura,項目名稱:go-dbflute-example,代碼行數:23,代碼來源:employee.go

示例5: getTotalPage

func (r *GoReport) getTotalPage(lineno int, list *df.List) int {
	count := 0
	page := 0
	for i, l := range list.GetAsArray() {
		if l.(*pagehist).line >= lineno {
			count = i
			break
		}
	}
	for i := count; i < list.Size(); i++ {
		newpage := list.Get(i).(*pagehist).page
		if newpage <= page {
			return page
		}
		page = newpage
		//fmt.Printf("page :%v\n", page)
	}
	return page
}
開發者ID:suzuken,項目名稱:goreport,代碼行數:19,代碼來源:goreport.go

示例6: SetNormalFetchResult

func SetNormalFetchResult(ar *df.List) map[string]interface{} {
	return SetFetchResult(ar.GetAsArray(), 0, 0, ar.Size())
}
開發者ID:mikeshimura,項目名稱:go-dbflute-example,代碼行數:3,代碼來源:util.go


注:本文中的github.com/mikeshimura/dbflute/df.List類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。