util

package
v0.0.0-...-a91912b Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildQuery

func BuildQuery(tableName string, db *gorm.DB, query *types.Query) *gorm.DB

func ChangeTypeToTypePointer

func ChangeTypeToTypePointer[T comparable](typ T) *T

func CheckSliceContain

func CheckSliceContain[T comparable](s []T, e T) bool

func CountOffsetPagination

func CountOffsetPagination(page, limit int) int

func CountTotalPagePagination

func CountTotalPagePagination(countDataPerPage, totalData int) int

func DefinePageLimitPagination

func DefinePageLimitPagination(page, limit int) (pagePagination int, limitPagination int)

func GenerateSQLGroupQueryString

func GenerateSQLGroupQueryString(tableAlias string, groups []types.GroupOperation) string

func GenerateSQLOrderQueryString

func GenerateSQLOrderQueryString(tableAlias string, orders []types.OrderOperation) string

func GenerateSQLSelectQuerySlice

func GenerateSQLSelectQuerySlice(tableAlias string, selects []types.SelectOperation) []string

func GenerateSQLWhereQueryStringAndBindValues

func GenerateSQLWhereQueryStringAndBindValues(tableAlias string, searches [][]types.SearchOperation) (string, []any)

func GetMapKeys

func GetMapKeys[K comparable, V any](m map[K]V) []K

func GetMapValues

func GetMapValues[K comparable, V any](m map[K]V) []V

func JSONMarshal

func JSONMarshal(v any) (string, error)

func JSONUnmarshal

func JSONUnmarshal(s string, v any) error

func MergeSlices

func MergeSlices[T comparable](withUnique bool, slices ...[]T) []T

func MergeStructs

func MergeStructs[T comparable](withOverride bool, structs ...T) T

Types

This section is empty.

Jump to

Keyboard shortcuts

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