queryopt

package
v0.2.16 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package queryopt builds small GORM-compatible query fragments.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Asc

func Asc(field string) string

Asc returns an ascending order expression.

func Desc

func Desc(field string) string

Desc returns a descending order expression.

func Eq

func Eq(field, value any) (string, any)

Eq returns an equality query fragment.

func Ge

func Ge(field, value any) (string, any)

Ge returns a greater-than-or-equal query fragment.

func Gt

func Gt(field, value any) (string, any)

Gt returns a greater-than query fragment.

func In

func In[T InValue](field string, list []T) (string, any)

In returns a "field in ?" query fragment.

func IsNotNull

func IsNotNull(field string) string

IsNotNull returns an IS NOT NULL query expression.

func IsNull

func IsNull(field string) string

IsNull returns an IS NULL query expression.

func Le

func Le(field, value any) (string, any)

Le returns a less-than-or-equal query fragment.

func LeftLike

func LeftLike(field, value string) (string, string)

LeftLike returns a suffix LIKE query fragment.

func Like

func Like(field, value string) (string, string)

Like returns a contains LIKE query fragment.

func Lt

func Lt(field, value any) (string, any)

Lt returns a less-than query fragment.

func Ne

func Ne(field, value any) (string, any)

Ne returns a not-equal query fragment.

func NotIn

func NotIn[T InValue](field string, list []T) (string, any)

NotIn returns a "field not in ?" query fragment.

func RightLike

func RightLike(field, value string) (string, string)

RightLike returns a prefix LIKE query fragment.

Types

type InValue added in v0.2.5

type InValue interface {
	~int | ~int8 | ~int16 | ~int32 | ~int64 |
		~uint | ~uint16 | ~uint32 | ~uint64 |
		~string
}

InValue is the set of primitive values accepted by IN helpers.

Jump to

Keyboard shortcuts

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