queries

package
v0.1.12 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package queries provides a set of SQL queries based on the driver

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Builder

type Builder interface {
	CheckTableExitsQuery(tableName string) (string, []any)
	ColumnsList(tableName string) (string, []any)
	ListTables() string
	ListRows(tableName, orderCol, orderBy string, limit, offset int) (string, []any, error)
	DeleteTable(tableName string) string
	GetRows(tableName string, limit, offset int) (string, []any, error)
	DeleteRow(string, []models.ColValue, int) (string, []any, error)
	UpdateRow(tableName string, form []models.ColValue) (string, []any, error)
	InsertRow(tableName string, form []models.ColValue) (string, []any, error)
	CreateTable(tableName string, inputs []models.ColValue) (string, error)
	QuoteName(name string) string
}

func NewBuilder

func NewBuilder(driver configs.Driver, maxLimit int) (Builder, error)

type Dialect added in v0.1.7

type Dialect interface {
	Name() configs.Driver
	CheckTableExists(tableName string) (string, []any)
	ListTables() string
	ListColumns(tableName string) (string, []any)
	PlaceHolder(n int) (string, error)
	QuoteName(tableName string) string
	AutoIncrementKeyword() string
	InsertDefaultValues(tableName string) string
	DeleteRow(tableName string, whereClause string) string
	FilterOneRowClause(tableName, whereClause string) string
	WhereCluse(cols []models.ColValue, argsIdx int) (string, []any, error)
}

func GetDialect added in v0.1.7

func GetDialect(name configs.Driver) (Dialect, error)

type MySQLDialect added in v0.1.7

type MySQLDialect struct{}

MySQLDialect implementation

func (*MySQLDialect) AutoIncrementKeyword added in v0.1.7

func (d *MySQLDialect) AutoIncrementKeyword() string

func (*MySQLDialect) CheckTableExists added in v0.1.7

func (d *MySQLDialect) CheckTableExists(tableName string) (string, []any)

func (*MySQLDialect) DeleteRow added in v0.1.7

func (d *MySQLDialect) DeleteRow(tableName string, whereClause string) string

func (*MySQLDialect) FilterOneRowClause added in v0.1.7

func (d *MySQLDialect) FilterOneRowClause(tableName, whereClause string) string

func (*MySQLDialect) InsertDefaultValues added in v0.1.7

func (d *MySQLDialect) InsertDefaultValues(tableName string) string

func (*MySQLDialect) ListColumns added in v0.1.7

func (d *MySQLDialect) ListColumns(tableName string) (string, []any)

func (*MySQLDialect) ListTables added in v0.1.7

func (d *MySQLDialect) ListTables() string

func (*MySQLDialect) Name added in v0.1.7

func (d *MySQLDialect) Name() configs.Driver

func (*MySQLDialect) PlaceHolder added in v0.1.7

func (d *MySQLDialect) PlaceHolder(n int) (string, error)

func (*MySQLDialect) QuoteName added in v0.1.7

func (d *MySQLDialect) QuoteName(tableName string) string

func (*MySQLDialect) WhereCluse added in v0.1.7

func (d *MySQLDialect) WhereCluse(cols []models.ColValue, argsIdx int) (string, []any, error)

type PostgresDialect added in v0.1.7

type PostgresDialect struct{}

PostgresDialect implementation

func (*PostgresDialect) AutoIncrementKeyword added in v0.1.7

func (d *PostgresDialect) AutoIncrementKeyword() string

func (*PostgresDialect) CheckTableExists added in v0.1.7

func (d *PostgresDialect) CheckTableExists(tableName string) (string, []any)

func (*PostgresDialect) DeleteRow added in v0.1.7

func (d *PostgresDialect) DeleteRow(tableName string, whereClause string) string

func (*PostgresDialect) FilterOneRowClause added in v0.1.7

func (d *PostgresDialect) FilterOneRowClause(tableName, whereClause string) string

func (*PostgresDialect) InsertDefaultValues added in v0.1.7

func (d *PostgresDialect) InsertDefaultValues(tableName string) string

func (*PostgresDialect) ListColumns added in v0.1.7

func (d *PostgresDialect) ListColumns(tableName string) (string, []any)

func (*PostgresDialect) ListTables added in v0.1.7

func (d *PostgresDialect) ListTables() string

func (*PostgresDialect) Name added in v0.1.7

func (d *PostgresDialect) Name() configs.Driver

func (*PostgresDialect) PlaceHolder added in v0.1.7

func (d *PostgresDialect) PlaceHolder(n int) (string, error)

func (*PostgresDialect) QuoteName added in v0.1.7

func (d *PostgresDialect) QuoteName(tableName string) string

func (*PostgresDialect) WhereCluse added in v0.1.7

func (d *PostgresDialect) WhereCluse(cols []models.ColValue, argsIdx int) (string, []any, error)

type SQLiteDialect added in v0.1.7

type SQLiteDialect struct{}

SQLiteDialect implementation

func (*SQLiteDialect) AutoIncrementKeyword added in v0.1.7

func (d *SQLiteDialect) AutoIncrementKeyword() string

func (*SQLiteDialect) CheckTableExists added in v0.1.7

func (d *SQLiteDialect) CheckTableExists(tableName string) (string, []any)

func (*SQLiteDialect) DeleteRow added in v0.1.7

func (d *SQLiteDialect) DeleteRow(tableName string, whereClause string) string

func (*SQLiteDialect) FilterOneRowClause added in v0.1.7

func (d *SQLiteDialect) FilterOneRowClause(tableName, whereClause string) string

func (*SQLiteDialect) InsertDefaultValues added in v0.1.7

func (d *SQLiteDialect) InsertDefaultValues(tableName string) string

func (*SQLiteDialect) ListColumns added in v0.1.7

func (d *SQLiteDialect) ListColumns(tableName string) (string, []any)

func (*SQLiteDialect) ListTables added in v0.1.7

func (d *SQLiteDialect) ListTables() string

func (*SQLiteDialect) Name added in v0.1.7

func (d *SQLiteDialect) Name() configs.Driver

func (*SQLiteDialect) PlaceHolder added in v0.1.7

func (d *SQLiteDialect) PlaceHolder(n int) (string, error)

func (*SQLiteDialect) QuoteName added in v0.1.7

func (d *SQLiteDialect) QuoteName(tableName string) string

func (*SQLiteDialect) WhereCluse added in v0.1.7

func (d *SQLiteDialect) WhereCluse(cols []models.ColValue, argsIdx int) (string, []any, error)

Jump to

Keyboard shortcuts

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