utils

package
v0.0.0-...-6ed4abe Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package utils xxx

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RawCond

func RawCond(sql string, args ...interface{}) gen.Condition

RawCond 自定义sql语句,支持所有mysql逻辑运算符以及mysql函数 RawCond("JSON_UNQUOTE(column_name) = xxx ") SELECT * FROM `table_name` JSON_UNQUOTE(column_name) = "xxx"

RawCond("JSON_UNQUOTE(?) = ?", "column_name", "xxx") SELECT * FROM `table_name` JSON_UNQUOTE("column_name") = "xxx"

RawCond("JSON_UNQUOTE(?) = ?", Field{Field: "column_name", Table: &q} , "xxx") SELECT * FROM `table_name` JSON_UNQUOTE("table_name"."column_name") = "xxx"

RawCond("column_name != xxx ") SELECT * FROM `table_name` column_name != "xxx"

RawCond("column_name in (?)",[]uint32{1,2,4}) SELECT * FROM `table_name` column_name in (1,2,4)

RawCond("column_name > ?", 3) SELECT * FROM `table_name` WHERE column_name > 3

RawCond("column_name like ?", "%s%") SELECT * FROM `table_name` WHERE column_name like '%s%'

Types

type CustomExpr

type CustomExpr struct {
	SQL                string
	Vars               []interface{}
	WithoutParentheses bool
	field.Expr
}

CustomExpr raw expression

func NewCustomExpr

func NewCustomExpr(sql string, value []interface{}) CustomExpr

NewCustomExpr custom expression

func (CustomExpr) Build

func (expr CustomExpr) Build(builder clause.Builder)

Build build raw expression

type Field

type Field struct {
	Field field.Expr
	Table Tabler
}

Field xxx

type Tabler

type Tabler interface {
	Alias() string
	TableName() string
}

Tabler xxx

Jump to

Keyboard shortcuts

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