godb

package
v1.2.93 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

README

Golang 数据库操作集

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateSliceIn

func GenerateSliceIn[T any](srcItems []T) (string, []any)

func GenerateSliceInEx

func GenerateSliceInEx[T any](fieldName string, srcItems []T) (string, []any)

func WhereIntArray

func WhereIntArray[T int | int64 | int32](items []int64) string

func WhereStringArray

func WhereStringArray(items []string) string

Types

type NumberRangeController

type NumberRangeController[T int64 | int | float64] struct {
	Min *T `json:"min,optional"`
	Max *T `json:"max,optional"`
}

func (*NumberRangeController[T]) Where

func (c *NumberRangeController[T]) Where(column string) (string, []any)

type OrderItem

type OrderItem struct {
	Column string `json:"column"`
	Asc    bool   `json:"asc"`
}

type Page

type Page struct {
	PageNo      int64        `json:"page_no,optional"`
	PageSize    int64        `json:"page_size,optional"`
	StartTime   int64        `json:"start_time,optional"`
	EndTime     int64        `json:"end_time,optional"`
	SortBy      []*OrderItem `json:"sort_by,optional"`
	GroupBy     []string     `json:"group_by,optional"`
	IgnoreTotal bool         `json:"ignore_total,optional"`
	OnlyTotal   bool         `json:"only_total,optional"`
	Ids         []int64      `json:"ids,optional"`
	States      []int64      `json:"ids,optional"`
}

func (*Page) GroupByStr

func (p *Page) GroupByStr() string

func (*Page) OrderBy

func (p *Page) OrderBy() string

func (*Page) OrderByExt

func (p *Page) OrderByExt() string

func (*Page) PageLimit

func (p *Page) PageLimit() string

type SelectController

type SelectController[T int64 | string] struct {
	Values  []T  `json:"values,optional"`
	Exclude bool `json:"exclude,optional"`
}

func (*SelectController[T]) ClickHouseWhere

func (c *SelectController[T]) ClickHouseWhere(column string) (string, []T)

func (*SelectController[T]) MysqlWhere

func (c *SelectController[T]) MysqlWhere(column string) (string, []any)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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