Documentation ¶
Index ¶
- Variables
- func ArrToChan[T interface{}](arr []T) chan T
- func ArrayContains[T comparable](arr []T, elem T) bool
- func ArrayDiffer[T interface{}](existing []T, updated []T, hasSameId func(a, b T) bool, ...) errors.ServiceError
- func ArrayFilter[T interface{}](arr []T, predicate func(elem T) bool) []T
- func ArrayFirst[T interface{}](arr []*T) *T
- func ArrayMap[T interface{}, R interface{}](arr []T, mapper func(T) R) []R
- func ArrayMapString(arr []string, mapper func(string) string) []string
- func ArrayMapToId[T HasId](arr []T) []string
- func ArrayMapToInterface[T interface{}](arr []T) []interface{}
- func ArrayMapToString[T interface{}](arr []T, fn func(t T) string) []string
- func ArrayMapWithError[T interface{}, R interface{}](arr []T, mapper func(T) (R, errors.ServiceError)) ([]R, errors.ServiceError)
- func ArrayMapX[T interface{}, R interface{}](arr []*T, mapper func(*T) *R) []*R
- func ArrayPrepend[T interface{}](arr []*T, elem *T) []*T
- func ArrayToMap[T interface{}, R interface{}, K comparable](arr []T, keyFunc func(T) K, valueFunc func(T) R) map[K]R
- func ArrayUnique[T comparable](slice []T) []T
- func Capitalize(str string) string
- func Coalesce[T interface{}](val ...*T) *T
- func CoalesceThen[T interface{}](fn func(val *T) errors.ServiceError, val ...*T) errors.ServiceError
- func DeCapitalize(str string) string
- func DePointer[T interface{}](val *T, defaultValue T) T
- func EncodeKey(key string) (string, error)
- func FlatMap[T interface{}](arr ...[]T) []T
- func FromAny[T proto.Message](anyItem *anypb.Any, instance T) T
- func GetArrayIndex[T comparable](items []T, item T, comparator func(a, b T) bool) int
- func GetErrorCode(err error) model.ErrorCode
- func GetErrorFields(err error) []*model.ErrorField
- func GetErrorMessage(err error) string
- func GetNamedMap[T Named](items []T) map[string]T
- func GetRecordId(record *model.Record) string
- func GetResourceSinglePrimaryProp(resource *model.Resource) *model.ResourceProperty
- func HasResourcePrimaryProp(resource *model.Resource) bool
- func HasResourceSinglePrimaryProp(resource *model.Resource) bool
- func HistoryPlan(plan *model.ResourceMigrationPlan) *model.ResourceMigrationPlan
- func HistoryResource(resource *model.Resource) *model.Resource
- func IdRecord(id string) *model.Record
- func IsSameIdentifiedResourceIndex(index1, index2 *model.ResourceIndex) bool
- func IsSameIdentifiedResourceProperty(property1, property2 *model.ResourceProperty) bool
- func IsSameRecord(existing, updated *model.Record) bool
- func IsSameResourceIndex(index1, index2 *model.ResourceIndex) bool
- func IsSameResourceProperty(property1, property2 *model.ResourceProperty) bool
- func IsSystemContext(ctx context.Context) bool
- func LocateArrayElement[T interface{}](arr []*T, test func(elem *T) bool) *T
- func LocatePropertyByName(resource *model.Resource, propertyName string) *model.ResourceProperty
- func MapStructValue(v map[string]interface{}) *structpb.Value
- func NewContextWithValues(parent context.Context, valuesFrom context.Context) context.Context
- func NormalizeResource(resource *model.Resource)
- func ParseType(elemType string) abs.ResourceIdentity
- func PathSlug(s string) string
- func Pointer[T interface{}](val T) *T
- func PrepareQuery(resource *model.Resource, queryMap map[string]string) (*model.BooleanExpression, errors.ServiceError)
- func PrepareQueryFromFilters(resource *model.Resource, filters map[string]string) (*model.BooleanExpression, errors.ServiceError)
- func PropertiesWithTitleToJsonSchema(resource *model.Resource, elem PropertiesWithTitleAndDescription) *openapi3.Schema
- func QueryAndExpression(left *model.BooleanExpression, right *model.BooleanExpression) *model.BooleanExpression
- func QueryEqualExpression(propertyName string, val *structpb.Value) *model.BooleanExpression
- func QueryInExpression(propertyName string, val *structpb.Value) *model.BooleanExpression
- func QueryOrExpression(left *model.BooleanExpression, right *model.BooleanExpression) *model.BooleanExpression
- func RandomHex(n int) string
- func Read(fileName string, msg proto.Message) error
- func ReadJson(fileName string, msg proto.Message) error
- func RecordIdentifierPrimaryProperties(resource *model.Resource, properties map[string]*structpb.Value) (map[string]*structpb.Value, bool)
- func RecordIdentifierProperties(resource *model.Resource, properties map[string]*structpb.Value) (map[string]*structpb.Value, error)
- func RecordIdentifierQuery(resource *model.Resource, properties map[string]*structpb.Value) (*model.BooleanExpression, error)
- func RecordIdentifierUniqueProperties(resource *model.Resource, properties map[string]*structpb.Value) (map[string]*structpb.Value, bool)
- func RecordMatchIdentifiableProperties(resource *model.Resource, record *model.Record, ...) (bool, error)
- func RecordPropertyAccessorByPath(properties map[string]*structpb.Value, path string) (getter func() *structpb.Value, setter func(val *structpb.Value))
- func RemarkResource(resource *model.Resource)
- func ResourceJsonSchemaName(item *model.Resource) string
- func ResourcePropertyTypeToJsonSchemaType(resource *model.Resource, property *model.ResourceProperty) *openapi3.SchemaRef
- func ResourceRestPath(resource *model.Resource) string
- func ResourceToJsonSchema(resource *model.Resource) *openapi3.Schema
- func ResourceWalkProperties(resource *model.Resource, ...)
- func SnakeCaseToCamelCase(inputUnderScoreStr string) (camelCase string)
- func StripSpaces(str string) string
- func StructKv(key string, value interface{}) *structpb.Value
- func StructKv2(key1 string, value1 interface{}, key2 string, value2 interface{}) *structpb.Value
- func ToAny(instance proto.Message) *anypb.Any
- func ToDashCase(str string) string
- func ToSnakeCase(str string) string
- func ToStatusError(err errors.ServiceError) error
- func VerifyKey(hash, key string) error
- func WithSystemContext(ctx context.Context) context.Context
- func Write(fileName string, msg proto.Message) error
- func WriteJson(fileName string, msg proto.Message) error
- type HasId
- type MapEntry
- type Named
- type PropertiesWithTitleAndDescription
- type PropertyAccessor
Constants ¶
This section is empty.
Variables ¶
View Source
var SystemContext = WithSystemContext(context.TODO())
Functions ¶
func ArrayContains ¶ added in v1.1.37
func ArrayContains[T comparable](arr []T, elem T) bool
func ArrayDiffer ¶
func ArrayDiffer[T interface{}](existing []T, updated []T, hasSameId func(a, b T) bool, isEqual func(a, b T) bool, onNew func(rec T) errors.ServiceError, onUpdate func(e, u T) errors.ServiceError, onDelete func(rec T) errors.ServiceError) errors.ServiceError
func ArrayFilter ¶ added in v1.1.37
func ArrayFilter[T interface{}](arr []T, predicate func(elem T) bool) []T
func ArrayFirst ¶
func ArrayFirst[T interface{}](arr []*T) *T
func ArrayMapToId ¶
func ArrayMapToInterface ¶
func ArrayMapToInterface[T interface{}](arr []T) []interface{}
func ArrayMapToString ¶
func ArrayMapWithError ¶
func ArrayMapWithError[T interface{}, R interface{}](arr []T, mapper func(T) (R, errors.ServiceError)) ([]R, errors.ServiceError)
func ArrayMapX ¶ added in v1.1.48
func ArrayMapX[T interface{}, R interface{}](arr []*T, mapper func(*T) *R) []*R
func ArrayPrepend ¶
func ArrayPrepend[T interface{}](arr []*T, elem *T) []*T
func ArrayToMap ¶ added in v1.1.37
func ArrayToMap[T interface{}, R interface{}, K comparable](arr []T, keyFunc func(T) K, valueFunc func(T) R) map[K]R
func ArrayUnique ¶ added in v1.1.37
func ArrayUnique[T comparable](slice []T) []T
func Capitalize ¶ added in v1.1.37
func CoalesceThen ¶
func CoalesceThen[T interface{}](fn func(val *T) errors.ServiceError, val ...*T) errors.ServiceError
func DeCapitalize ¶ added in v1.2.21
func GetArrayIndex ¶
func GetArrayIndex[T comparable](items []T, item T, comparator func(a, b T) bool) int
func GetErrorCode ¶
func GetErrorFields ¶
func GetErrorFields(err error) []*model.ErrorField
func GetErrorMessage ¶
func GetNamedMap ¶
func GetRecordId ¶ added in v1.2.36
func GetResourceSinglePrimaryProp ¶
func GetResourceSinglePrimaryProp(resource *model.Resource) *model.ResourceProperty
func HasResourcePrimaryProp ¶
func HistoryPlan ¶
func HistoryPlan(plan *model.ResourceMigrationPlan) *model.ResourceMigrationPlan
func IsSameIdentifiedResourceIndex ¶
func IsSameIdentifiedResourceIndex(index1, index2 *model.ResourceIndex) bool
func IsSameIdentifiedResourceProperty ¶
func IsSameIdentifiedResourceProperty(property1, property2 *model.ResourceProperty) bool
func IsSameRecord ¶
func IsSameResourceIndex ¶
func IsSameResourceIndex(index1, index2 *model.ResourceIndex) bool
func IsSameResourceProperty ¶
func IsSameResourceProperty(property1, property2 *model.ResourceProperty) bool
func IsSystemContext ¶ added in v1.1.37
func LocateArrayElement ¶ added in v1.1.37
func LocateArrayElement[T interface{}](arr []*T, test func(elem *T) bool) *T
func LocatePropertyByName ¶
func LocatePropertyByName(resource *model.Resource, propertyName string) *model.ResourceProperty
func MapStructValue ¶
func NewContextWithValues ¶ added in v1.2.21
func NormalizeResource ¶
func ParseType ¶ added in v1.3.15
func ParseType(elemType string) abs.ResourceIdentity
func PrepareQuery ¶
func PrepareQuery(resource *model.Resource, queryMap map[string]string) (*model.BooleanExpression, errors.ServiceError)
func PrepareQueryFromFilters ¶
func PrepareQueryFromFilters(resource *model.Resource, filters map[string]string) (*model.BooleanExpression, errors.ServiceError)
func PropertiesWithTitleToJsonSchema ¶ added in v1.1.37
func PropertiesWithTitleToJsonSchema(resource *model.Resource, elem PropertiesWithTitleAndDescription) *openapi3.Schema
func QueryAndExpression ¶ added in v1.1.37
func QueryAndExpression(left *model.BooleanExpression, right *model.BooleanExpression) *model.BooleanExpression
func QueryEqualExpression ¶ added in v1.1.37
func QueryEqualExpression(propertyName string, val *structpb.Value) *model.BooleanExpression
func QueryInExpression ¶ added in v1.1.37
func QueryInExpression(propertyName string, val *structpb.Value) *model.BooleanExpression
func QueryOrExpression ¶ added in v1.1.37
func QueryOrExpression(left *model.BooleanExpression, right *model.BooleanExpression) *model.BooleanExpression
func RecordIdentifierQuery ¶ added in v1.1.37
func RecordMatchIdentifiableProperties ¶ added in v1.1.37
func RecordPropertyAccessorByPath ¶ added in v1.1.37
func RemarkResource ¶
func ResourceJsonSchemaName ¶ added in v1.1.37
func ResourceRestPath ¶ added in v1.2.36
func ResourceToJsonSchema ¶ added in v1.1.37
func ResourceWalkProperties ¶ added in v1.1.37
func ResourceWalkProperties(resource *model.Resource, callback func(path string, property *model.ResourceProperty))
func SnakeCaseToCamelCase ¶
func StripSpaces ¶ added in v1.1.37
func ToDashCase ¶
func ToSnakeCase ¶
func ToStatusError ¶
func ToStatusError(err errors.ServiceError) error
func WithSystemContext ¶ added in v1.1.37
Types ¶
type MapEntry ¶ added in v1.2.57
type MapEntry[T interface{}] struct { Key string Val T }
func MapToArray ¶ added in v1.2.57
type PropertiesWithTitleAndDescription ¶ added in v1.1.37
type PropertiesWithTitleAndDescription interface { GetTitle() string GetDescription() string GetProperties() []*model.ResourceProperty }
type PropertyAccessor ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.