sql_enum

package
v0.4.11 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2025 License: MIT Imports: 1 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DatabaseDriver

type DatabaseDriver string
const (
	Postgres DatabaseDriver = "postgres"
	MySQL    DatabaseDriver = "mysql"
	SQLite   DatabaseDriver = "sqlite"
)

func (DatabaseDriver) Color

func (d DatabaseDriver) Color() string

func (DatabaseDriver) ColoredLabel

func (d DatabaseDriver) ColoredLabel() string

func (DatabaseDriver) Label

func (d DatabaseDriver) Label() string

func (DatabaseDriver) String

func (d DatabaseDriver) String() string

func (DatabaseDriver) Valid

func (d DatabaseDriver) Valid() bool

type ParamRequirements

type ParamRequirements struct {
	MinParams int // Минимальное количество параметров
	MaxParams int // Максимальное количество параметров (0 - без ограничений)
}

ParamRequirements описывает требования оператора к параметрам

type QueryOperator

type QueryOperator string
const (
	// Операторы сравнения (требуют 1 параметр)
	OpEqual              QueryOperator = "="
	OpNotEqual           QueryOperator = "!="
	OpGreaterThan        QueryOperator = ">"
	OpGreaterThanOrEqual QueryOperator = ">="
	OpLessThan           QueryOperator = "<"
	OpLessThanOrEqual    QueryOperator = "<="

	// Строковые операторы (требуют 1 параметр)
	OpLike    QueryOperator = "LIKE"
	OpNotLike QueryOperator = "NOT LIKE"
	OpILike   QueryOperator = "ILIKE" // case-insensitive LIKE

	// Операторы для массивов/множеств (требуют несколько параметров)
	OpIn         QueryOperator = "IN"
	OpNotIn      QueryOperator = "NOT IN"
	OpBetween    QueryOperator = "BETWEEN"     // требует 2 параметра
	OpNotBetween QueryOperator = "NOT BETWEEN" // требует 2 параметра

	// Null проверки (не требуют параметров)
	OpIsNull    QueryOperator = "IS NULL"
	OpIsNotNull QueryOperator = "IS NOT NULL"
)

func ParseOperator

func ParseOperator(input string) (QueryOperator, bool)

func (QueryOperator) GetRequirements

func (o QueryOperator) GetRequirements() ParamRequirements

GetRequirements возвращает требования оператора к параметрам

func (QueryOperator) String

func (o QueryOperator) String() string

func (QueryOperator) Suffix

func (o QueryOperator) Suffix() string

func (QueryOperator) ValidateParams

func (o QueryOperator) ValidateParams(paramsCount int) error

ValidateParams проверяет соответствие количества параметров требованиям оператора

Jump to

Keyboard shortcuts

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