mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-12 07:17:34 +00:00
cleanup
This commit is contained in:
@@ -12,16 +12,19 @@ const (
|
||||
NullInstruction Instruction = "NULL"
|
||||
)
|
||||
|
||||
// StatementBuilder is a helper to build SQL statement.
|
||||
type StatementBuilder struct {
|
||||
strings.Builder
|
||||
args []any
|
||||
existingArgs map[any]string
|
||||
}
|
||||
|
||||
// WriteArgs adds the argument to the statement and writes the placeholder to the query.
|
||||
func (b *StatementBuilder) WriteArg(arg any) {
|
||||
b.WriteString(b.AppendArg(arg))
|
||||
}
|
||||
|
||||
// AppebdArg adds the argument to the statement and returns the placeholder.
|
||||
func (b *StatementBuilder) AppendArg(arg any) (placeholder string) {
|
||||
if b.existingArgs == nil {
|
||||
b.existingArgs = make(map[any]string)
|
||||
@@ -39,12 +42,14 @@ func (b *StatementBuilder) AppendArg(arg any) (placeholder string) {
|
||||
return placeholder
|
||||
}
|
||||
|
||||
// AppendArgs adds the arguments to the statement and doesn't return the placeholders.
|
||||
func (b *StatementBuilder) AppendArgs(args ...any) {
|
||||
for _, arg := range args {
|
||||
b.AppendArg(arg)
|
||||
}
|
||||
}
|
||||
|
||||
// Args returns the arguments added to the statement.
|
||||
func (b *StatementBuilder) Args() []any {
|
||||
return b.args
|
||||
}
|
||||
|
Reference in New Issue
Block a user