Skip to content

Adjustable Queries #57

@lippserd

Description

@lippserd

Requirements

  • Not all columns may be used in queries.
  • WHERE clause used in statements must be adjustable. Default for DELETE for example is id IN (?) at the moment.
  • Executed query should be replaceable, e.g. ON DUPLICATE KEY may specify col = col + VALUES(col).
  • All functionality shall be usable w/o building custom types, e.g. table name, columns as string, []string.

Possible API

// Using query builder directly
sql := NewQueryBuilder(db, subject).SetColumns(columns).Insert()
db.NamedBulkExec(ctx, sql, ch)

// Functional options
db.Upsert(ctx, ch, options.SetColumns(columns))

// Using query builder directly #2
upsert := qb.Upsert(subject).Columns(columns)
db.NamedBulkExec(ctx, upsert, ch)
// or
upsert.Stream(ctx, db, ch)

db.Upsert().Columns(columns).Exec() // .Stream()

qb.Upsert().Columns().Exec(ctx, db, setofData) // .Stream(ctx, db, ch)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions