refilter

package module
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2020 License: MIT Imports: 5 Imported by: 0

README

refilter

Lib to simplify and abstract query filter in structs with reflection e.g. where

Documentation

Index

Constants

View Source
const (
	// LessThen suffix string
	LessThen = "Lt"
	// LessThenEqual suffix string
	LessThenEqual = "Lte"
	// GreaterThen suffix string
	GreaterThen = "Gt"
	// GreaterThenEqual suffix string
	GreaterThenEqual = "Gte"
)
View Source
const (
	// EmbeddedFilter filter embedded fields in struct
	EmbeddedFilter filterType = "embedded"
	// SkipTag is the value from FilterTag that skips a field in struct
	SkipTag filterType = "skip"
)

Variables

This section is empty.

Functions

func FilterByObject

func FilterByObject(tx *gorm.DB, obj interface{}, tableName string) *gorm.DB

FilterByObject filters all fields from object is used to query filter objects from gqlgen

func GetAlias

func GetAlias(tag reflect.StructTag) (alias []string)

GetAlias from tag object

func IsType

func IsType(tag reflect.StructTag, typeArg filterType) bool

IsType check if tag string contains the type from argument

Types

This section is empty.

Jump to

Keyboard shortcuts

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