crud

package
v0.4.1-alpha Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2024 License: MPL-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssignmentExistsInSlice

func AssignmentExistsInSlice[T Assignment](assignment T, assignments []T, compareFunc CompareFunc) bool

AssignmentExistsInSlice checks if a given assignment exists in a slice of assignments

func DefaultAssignmentsEqual

func DefaultAssignmentsEqual(a, b Assignment) bool

DefaultAssignmentsEqual compares two Assignment instances for equality

func ExistsInSlice

func ExistsInSlice[T any](item T, slice []T, compareFunc CompareFunc) bool

ExistsInSlice checks if a given item exists in a slice based on a comparison function

func HandleTimeout

func HandleTimeout(ctx context.Context, timeoutFunc func(context.Context, time.Duration) (time.Duration, diag.Diagnostics), defaultTimeout time.Duration, diags *diag.Diagnostics) (context.Context, context.CancelFunc)

HandleTimeout is a helper function to manage context timeouts

func IdentifiableExistsInSlice

func IdentifiableExistsInSlice[T Identifiable](item T, slice []T) bool

IdentifiableExistsInSlice checks if a given identifiable item exists in a slice based on ID

Types

type Assignment

type Assignment interface {
	Identifiable
	GetTarget() interface{}
}

Assignment is a generic interface for types that represent assignments

type CompareFunc

type CompareFunc func(a, b interface{}) bool

CompareFunc is a type for custom comparison functions

type Identifiable

type Identifiable interface {
	GetID() types.String
}

Identifiable is an interface for types that have an ID

Jump to

Keyboard shortcuts

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