db

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2026 License: Apache-2.0 Imports: 13 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	DefaultOffset = uint32(0)
	DefaultLimit  = uint32(20)
)
View Source
const (
	TagName              = "json"
	SearchWordColumnName = "search_word"
)
View Source
const (
	DefaultSelectLimit = 200
)

Variables

This section is empty.

Functions

func GetDisplayColumns

func GetDisplayColumns(displayColumns []string, wholeColumns []string) []string

func GetLimit

func GetLimit(n uint32) uint32

func GetLimitFromRequest

func GetLimitFromRequest(req RequestHadLimit) uint32

func GetOffset

func GetOffset(n uint32) uint32

func GetOffsetFromRequest

func GetOffsetFromRequest(req RequestHadOffset) uint32

Types

type Chain

type Chain struct {
	*gorm.DB
}

func GetChain

func GetChain(tx *gorm.DB) *Chain

func (*Chain) AddQueryOrderDir

func (c *Chain) AddQueryOrderDir(req Request, defaultColumn string) *Chain

func (*Chain) BuildFilterConditions

func (c *Chain) BuildFilterConditions(req Request, tableName string, exclude ...string) *Chain

func (*Chain) BuildOwnerPathFilter

func (c *Chain) BuildOwnerPathFilter(ctx context.Context, req Request, andConditions []string, orConditions []string) *Chain

type Database

type Database struct {
	*gorm.DB
	// contains filtered or unexported fields
}

func OpenDatabase

func OpenDatabase(cfg *config.Config) (*Database, error)

func (*Database) Close

func (p *Database) Close() error

type Request

type Request interface {
	Reset()
	String() string
	ProtoMessage()
	Descriptor() ([]byte, []int)
}

type RequestHadLimit

type RequestHadLimit interface {
	GetLimit() uint32
}

type RequestHadOffset

type RequestHadOffset interface {
	GetOffset() uint32
}

type RequestWithOwnerPath

type RequestWithOwnerPath interface {
	Request
	GetOwnerPath() []string
}

type RequestWithReverse

type RequestWithReverse interface {
	RequestWithSortKey
	GetReverse() bool
}

type RequestWithSortKey

type RequestWithSortKey interface {
	Request
	GetSortKey() string
}

Jump to

Keyboard shortcuts

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