Documentation ¶
Index ¶
- func Deref[T any](t *T) T
- func FormatISO(t time.Time) string
- func Must[T any](v T, err error) T
- func OptionalElsePtr[T, R any](o optional.Optional[T], fn func(T) R) *R
- func OptionalID(id xid.ID) *xid.ID
- func OptionalPointer[T Zeroable](t T) optional.Optional[T]
- func OptionalSlice[T any](t []T) optional.Optional[[]T]
- func OptionalToPointer[T any](o optional.Optional[T]) *T
- func OptionalZero[T Zeroable](t T) optional.Optional[T]
- func Ref[T any](t T) *T
- func SetIfPresent[T any](m model.Mutation, field string, value optional.Optional[T])
- func TestAll[T any](t *testing.T, implementations []ImplConstructor[T], fn func(*testing.T, T))
- func ToMap[T any, R any](fn func(t T) R) func(t T) R
- type ImplConstructor
- type Zeroable
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func OptionalElsePtr ¶
func OptionalID ¶
OptionalID is a special helper only used for tests where the seed data must set IDs for resources by calling `WithID`. In this case, the ID must be set using Ent's `SetNillableID` builder method. This function works by taking a a pointer to an ID and only setting it if the pointer is not nil. The problem with this is that all resource structs use IDs as values, not pointers so in order to derive a pointer that may or may not be nil, this function simply checks if the xid is considered "valid" and if it isn't, simply returns nil.
func OptionalPointer ¶
func OptionalSlice ¶
func OptionalToPointer ¶
func OptionalZero ¶
func SetIfPresent ¶
Types ¶
type ImplConstructor ¶
type ImplConstructor[T any] func() T
Source Files ¶
Click to show internal directories.
Click to hide internal directories.