Documentation ¶
Overview ¶
Package dnsimplex contains utility functions for working with the DNSimple API.
Index ¶
- func All[T any](ctx context.Context, ...) ([]T, error)
- func Each[T any](_ context.Context, ...) error
- func Errorf(format string, args ...any) error
- func Find[T, V any](ctx context.Context, ...) (result V, ok bool, err error)
- func First[T any](ctx context.Context, ...) (T, bool, error)
- func IgnoreNotFound(err error) error
- func IsNotFound(err error) bool
- func One[T any](ctx context.Context, ...) (T, bool, error)
- func RecordHasAttributes(r dnsimple.ZoneRecord, a dnsimple.ZoneRecordAttributes) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func All ¶
func All[T any]( ctx context.Context, list func(dnsimple.ListOptions) (*dnsimple.Pagination, []T, error), ) ([]T, error)
All returns a slice of all the values returned by list.
list is called once for each page of results.
func Each ¶
func Each[T any]( _ context.Context, list func(dnsimple.ListOptions) (*dnsimple.Pagination, []T, error), fn func(T) (bool, error), ) error
Each calls fn for each value returned by list.
list is called once for each page of results.
If fn returns false, the iteration stops.
func Find ¶
func Find[T, V any]( ctx context.Context, list func(dnsimple.ListOptions) (*dnsimple.Pagination, []T, error), fn func(T) (V, bool, error), ) (result V, ok bool, err error)
Find calls fn for each value returned by list until fn returns true.
It returns the result of fn.
func First ¶
func First[T any]( ctx context.Context, list func(dnsimple.ListOptions) (*dnsimple.Pagination, []T, error), pred func(T) bool, ) (T, bool, error)
First returns the first value returned by list for which pred returns true.
list is called once for each page of results.
func IgnoreNotFound ¶
IgnoreNotFound returns nil if err is a non-found error, otherwise it returns err unchanged.
func IsNotFound ¶
IsNotFound returns true if err is an error response from dnsimple.com that indicates that the requested resource does not exist.
func One ¶
func One[T any]( ctx context.Context, list func(dnsimple.ListOptions) (*dnsimple.Pagination, []T, error), ) (T, bool, error)
One returns the first value returned by list.
func RecordHasAttributes ¶
func RecordHasAttributes( r dnsimple.ZoneRecord, a dnsimple.ZoneRecordAttributes, ) bool
RecordHasAttributes returns true if the attributes of r are equivalent to the values in a.
Types ¶
This section is empty.