diff options
Diffstat (limited to 'lib/sql/op_where.go')
| -rw-r--r-- | lib/sql/op_where.go | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/sql/op_where.go b/lib/sql/op_where.go new file mode 100644 index 00000000..4330fb10 --- /dev/null +++ b/lib/sql/op_where.go @@ -0,0 +1,22 @@ +// SPDX-License-Identifier: BSD-3-Clause +// SPDX-FileCopyrightText: 2024 Shulhan <ms@kilabit.info> + +package sql + +// OpWhere stores the operation for WHERE conditions from calling +// [Meta.BindWhere]. +type OpWhere struct { + val any + logic string + column string + comp string + holder string +} + +func (op OpWhere) String() string { + // The space between column is required for "IS" like comparison. + if op.logic == `` { + return ` ` + op.column + ` ` + op.comp + ` ` + op.holder + } + return ` ` + op.logic + ` ` + op.column + ` ` + op.comp + ` ` + op.holder +} |
