当前位置: 首页>>代码示例>>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;未经允许,请勿转载。