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


Golang toolkit.NewStrBuffer函數代碼示例

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


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

示例1: Super

func (this *QueryBuilder) Super(translator db.Translator) {
	this.translator = translator
	this.columnPart = tk.NewJoiner(", ")
	this.fromPart = tk.NewJoiner(", ")
	this.joinPart = tk.NewStrBuffer()
	this.wherePart = tk.NewJoiner(" AND ")
	this.groupPart = tk.NewJoiner(", ")
	this.havingPart = tk.NewStrBuffer()
	this.orderPart = tk.NewJoiner(", ")
	this.unionPart = tk.NewStrBuffer()

}
開發者ID:quintans,項目名稱:goSQL,代碼行數:12,代碼來源:GenericTranslator.go

示例2: dumpParameters

func (this *DmlBase) dumpParameters(params map[string]interface{}) string {
	str := tk.NewStrBuffer()
	for name, v := range params {
		if strings.HasSuffix(name, "$") {
			// secret
			str.Add(fmt.Sprintf("[%s=****]", name))
		} else if v != nil {
			typ := reflect.ValueOf(v)
			k := typ.Kind()
			if k == reflect.Slice || k == reflect.Array {
				str.Add(fmt.Sprintf("[%s=<BLOB>]", name))
			} else if k == reflect.Ptr {
				if typ.IsNil() {
					str.Add(fmt.Sprintf("[%s=NULL]", name))
				} else {
					str.Add(fmt.Sprintf("[%s=(*)%v]", name, typ.Elem().Interface()))
				}
			} else {
				str.Add(fmt.Sprintf("[%s=%v]", name, typ.Interface()))
			}
		} else {
			str.Add(fmt.Sprintf("[%s=NULL]", name))
		}
	}

	return str.String()
}
開發者ID:quintans,項目名稱:goSQL,代碼行數:27,代碼來源:DmlBase.go

示例3: String

func (this *Author) String() string {
	sb := tk.NewStrBuffer()
	sb.Add("{Id: ", this.Id, ", Version: ", this.Version)
	sb.Add(", Name: ", this.Name)
	sb.Add("}")
	return sb.String()
}
開發者ID:quintans,項目名稱:goSQL,代碼行數:7,代碼來源:entities.go

示例4: String

func (this *Board) String() string {
	sb := toolkit.NewStrBuffer()
	sb.Add("{Id: ", this.Id, ", Version: ", this.Version)
	sb.Add(", Name: ", this.Name)
	sb.Add(", Description: ", this.Description)
	sb.Add("}")
	return sb.String()
}
開發者ID:quintans,項目名稱:taskboard,代碼行數:8,代碼來源:0_Board.go

示例5: String

func (this *Role) String() string {
	sb := toolkit.NewStrBuffer()
	sb.Add("{Id: ", this.Id, ", Version: ", this.Version)
	sb.Add(", Kind: ", this.Kind)
	sb.Add(", *UserId: ", *this.UserId)
	sb.Add("}")
	return sb.String()
}
開發者ID:quintans,項目名稱:taskboard,代碼行數:8,代碼來源:0_Role.go

示例6: String

func (this *Notification) String() string {
	sb := toolkit.NewStrBuffer()
	sb.Add("{Id: ", this.Id, ", Version: ", this.Version)
	sb.Add(", Email: ", this.Email)
	sb.Add(", TaskId: ", this.TaskId)
	sb.Add(", LaneId: ", this.LaneId)
	sb.Add("}")
	return sb.String()
}
開發者ID:quintans,項目名稱:taskboard,代碼行數:9,代碼來源:0_Notification.go

示例7: String

func (this *Lane) String() string {
	sb := toolkit.NewStrBuffer()
	sb.Add("{Id: ", this.Id, ", Version: ", this.Version)
	sb.Add(", Name: ", this.Name)
	sb.Add(", Position: ", this.Position)
	sb.Add(", *BoardId: ", *this.BoardId)
	sb.Add("}")
	return sb.String()
}
開發者ID:quintans,項目名稱:taskboard,代碼行數:9,代碼來源:0_Lane.go

示例8: String

func (this *User) String() string {
	sb := toolkit.NewStrBuffer()
	sb.Add("{Id: ", this.Id, ", Version: ", this.Version)
	sb.Add(", Name: ", this.Name)
	sb.Add(", Username: ", this.Username)
	sb.Add(", Password: ", this.Password)
	sb.Add("}")
	return sb.String()
}
開發者ID:quintans,項目名稱:taskboard,代碼行數:9,代碼來源:0_User.go

示例9: rethrow

func rethrow(code string, cause error, sql string, params ...interface{}) error {
	causeMessage := cause.Error()

	msg := tk.NewStrBuffer(causeMessage, "\nSQL: ", sql, "\nParameters: ")
	if params != nil {
		msg.Add(fmt.Sprintf("%v", params))
	}

	return NewPersistenceFail(code, msg.String())
}
開發者ID:quintans,項目名稱:goSQL,代碼行數:10,代碼來源:SimpleDBA.go

示例10: GetSqlForInsert

func (this *GenericTranslator) GetSqlForInsert(insert *db.Insert) string {
	proc := this.CreateInsertProcessor(insert)

	str := tk.NewStrBuffer()
	// INSERT
	str.Add("INSERT INTO ", proc.TablePart(),
		"(", proc.ColumnPart(), ") VALUES(", proc.ValuePart(), ")")

	return str.String()
}
開發者ID:quintans,項目名稱:goSQL,代碼行數:10,代碼來源:GenericTranslator.go

示例11: RolloverParameter

func RolloverParameter(dmlType db.DmlType, tx db.Translator, parameters []db.Tokener, separator string) string {
	sb := tk.NewStrBuffer()
	for f, p := range parameters {
		if f > 0 && separator != "" {
			sb.Add(separator)
		}
		sb.Add(tx.Translate(dmlType, p))
	}
	return sb.String()
}
開發者ID:quintans,項目名稱:goSQL,代碼行數:10,代碼來源:GenericTranslator.go

示例12: PaginateSQL

func (this *MySQL5Translator) PaginateSQL(query *db.Query, sql string) string {
	sb := tk.NewStrBuffer()
	if query.GetLimit() > 0 {
		sb.Add(sql, " LIMIT :", db.OFFSET_PARAM, ", :", db.LIMIT_PARAM)
		if query.GetSkip() >= 0 {
			query.SetParameter(db.OFFSET_PARAM, query.GetSkip())
		}
		query.SetParameter(db.LIMIT_PARAM, query.GetLimit())
		return sb.String()
	}

	return sql
}
開發者ID:quintans,項目名稱:goSQL,代碼行數:13,代碼來源:MySQL5Translator.go

示例13: GetSqlForDelete

func (this *GenericTranslator) GetSqlForDelete(del *db.Delete) string {
	proc := this.CreateDeleteProcessor(del)

	sb := tk.NewStrBuffer()

	sb.Add("DELETE FROM ", proc.TablePart())
	where := proc.WherePart()
	// INNER JOINS NOT IMPLEMENTED
	if where != "" {
		sb.Add(" WHERE ", where)
	}

	return sb.String()
}
開發者ID:quintans,項目名稱:goSQL,代碼行數:14,代碼來源:GenericTranslator.go

示例14: SubstituteNamedParameters

// Parse the SQL statement and locate any placeholders or named parameters.
// Named parameters are substituted for a '?' placeholder
//
// param parsedSql
//            the parsed represenation of the SQL statement
// param paramSource
//            the source for named parameters
// return the SQL statement with substituted parameters
// see #parseSqlStatement
func SubstituteNamedParameters(parsedSql *ParsedSql, translator Translator) string {
	originalSql := parsedSql.String()
	actualSql := tk.NewStrBuffer()
	paramNames := parsedSql.Names
	lastIndex := 0
	for i, v := range paramNames {
		indexes := parsedSql.Indexes[i]
		startIndex := indexes[0]
		endIndex := indexes[1]
		actualSql.Add(originalSql[lastIndex:startIndex])
		actualSql.Add(translator.GetPlaceholder(i, v))
		lastIndex = endIndex
	}
	actualSql.Add(originalSql[lastIndex:])
	return actualSql.String()
}
開發者ID:quintans,項目名稱:goSQL,代碼行數:25,代碼來源:NamedParameterUtils.go

示例15: GetSqlForUpdate

func (this *GenericTranslator) GetSqlForUpdate(update *db.Update) string {
	proc := this.CreateUpdateProcessor(update)

	// SET
	sel := tk.NewStrBuffer()
	sel.Add("UPDATE ", proc.TablePart())
	sel.Add(" SET ", proc.ColumnPart())
	// JOINS
	// sel.Add(proc.joinPart.String())
	// WHERE - conditions
	if update.GetCriteria() != nil {
		sel.Add(" WHERE ", proc.WherePart())
	}

	return sel.String()
}
開發者ID:quintans,項目名稱:goSQL,代碼行數:16,代碼來源:GenericTranslator.go


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