aboutsummaryrefslogtreecommitdiff
path: root/lib/sql/meta.go
AgeCommit message (Collapse)Author
8 dayslib/sql: refactoring the BindWhereShulhan
Changes the BindWhere parameters from two to four. The first parameter is the OR/AND logic. The second parameter is the column name. The third parameter is the operator like "=", "!=". The fourth parameter is the value.
2026-01-15all: convert license and copyright to use SPDX identifiersShulhan
With help of spdxconv tool [1], we able to bulk update all files license and copyright format to comply with SPDX formats. [1] https://kilabit.info/project/spdxconv/
2024-02-29lib/sql: handle binding with the same nameShulhan
If [Meta.Bind] is called with the same name again, it should replace the existing named value.
2024-01-30lib/sql: refactor WhereFields to join where condition with holder as isShulhan
When binding parameter with BindWhere, the first parameter will be joined with the holder. For example, BindWhere("colname>=", p) will result in "colname>=$1". While at it, set offset based on [Meta.kind].
2024-01-27lib/sql: support update, bind where condition, and subquery in MetaShulhan
This changes add parameter kind to NewMeta, which define the kind of DML to be mapped by Meta. The method Add renamed to Bind, and AddWhere renamed to BindWhere. New methods added to Meta, - Sub return the child of Meta for building subquery, - UpdateValues return the merged of ListValue and ListWhereValue for DML UPDATE - WhereFields return string that merge the ListWhereCond and ListHolder separated by "="
2024-01-25lib/sql: add method WhereHolder to Meta typeShulhan
The WhereHolder method generate string of holder, for example "$1,$2,...", based on number of item added with [Meta.AddWhere]. Similar to method Holders but for where condition.
2024-01-25lib/sql: add new type MetaShulhan
Meta contains the DML meta data, including driver name, list of column names, list of column holders, and list of values. The Meta type replace the Row type.