sql

package
v1.73.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 9, 2026 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Overview

Package sql provides utilities for building SQL expressions from conditional expressions. This package is designed to work with the goqu library to construct SQL queries dynamically.

Supported Features: - Logical Operators:

  • AND: Combines multiple conditions with a logical AND.
  • OR: Combines multiple conditions with a logical OR.

- Comparison Operators:

  • = : Equal to
  • !=: Not equal to
  • > : Greater than
  • < : Less than
  • >=: Greater than or equal to
  • <=: Less than or equal to
  • IN: Checks if a value exists within a list of values
  • IS NULL: Checks if a field is null (no value required)
  • IS NOT NULL: Checks if a field is not null (no value required)

Limitations: - Only supports fields that are valid SQL identifiers:

  • Must contain only alphanumeric characters, `$`, and `_`.
  • Must be between 1 and 128 characters in length.

- Does not support advanced SQL features such as:

  • LIKE or ILIKE for pattern matching.
  • NOT IN or other negated set operations.
  • Complex expressions involving functions or subqueries.
  • Requires all conditions to have a non-empty field and operator. For most operators, a value is also required, except for IS NULL and IS NOT NULL.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConditionBuilder

type ConditionBuilder struct{}

func NewConditionBuilder

func NewConditionBuilder() *ConditionBuilder

func (ConditionBuilder) Build

func (ConditionBuilder) BuildCompositeAnd

func (cb ConditionBuilder) BuildCompositeAnd(cond condexpr.Condition) (goqu.Expression, error)

func (ConditionBuilder) BuildCompositeOr

func (cb ConditionBuilder) BuildCompositeOr(cond condexpr.Condition) (goqu.Expression, error)

func (ConditionBuilder) BuildLeafCondition

func (cb ConditionBuilder) BuildLeafCondition(cond condexpr.Condition) (goqu.Expression, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL