internal

package
v0.0.0-...-b14404a Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: BSD-3-Clause Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrCopyFailed = errors.New("copy failed at type assertion")

Functions

func ANSIDiff

func ANSIDiff(x, y any, opts ...cmp.Option) error

func Copy

func Copy[T any](t T) (T, error)

func GCD

func GCD(periods []int64) int64

func GetStructTags

func GetStructTags(a any, fn func(tag reflect.StructField) error) error

func IgnoreMapEntries

func IgnoreMapEntries(keys ...string) cmp.Option

func IsStruct

func IsStruct(v any) bool

func MarshalYAML

func MarshalYAML(v any) ([]byte, error)

func MarshalYAMLPreserveKeysOrder

func MarshalYAMLPreserveKeysOrder(v any) ([]byte, error)

func Or

func Or[T comparable](a, b T) T

func PrettyJSON

func PrettyJSON(v any) ([]byte, error)

func TrimQuotes

func TrimQuotes(s string) string

func TypeName

func TypeName(v any) string

func UnmarshalYAML

func UnmarshalYAML[T any](b []byte) (T, error)

func UnmarshalYAMLPreserveKeysOrder

func UnmarshalYAMLPreserveKeysOrder[T any](b []byte) (T, error)

func WriteFile

func WriteFile(name string, body []byte, overwrite bool) error

WriteFile writes a file to the filesystem.

Types

type CommandHandler

type CommandHandler interface {
	Exec(ctx context.Context) error
}

CommandHandler returns an error.

type CommandHandlerFunc

type CommandHandlerFunc func(ctx context.Context) error

func (CommandHandlerFunc) Exec

type DiffError

type DiffError struct {
	// contains filtered or unexported fields
}

func (*DiffError) Ansi

func (d *DiffError) Ansi() string

func (*DiffError) Error

func (d *DiffError) Error() string

func (*DiffError) SetColor

func (d *DiffError) SetColor(color bool)

func (*DiffError) Text

func (d *DiffError) Text() string

type Path

type Path struct {
	Dir      string
	FilePath string
	FileName string
	FileExt  string
}

func (*Path) String

func (o *Path) String() string

type QueryHandler

type QueryHandler[T any] interface {
	Exec(ctx context.Context) (T, error)
}

QueryHandler returns a value and an error.

type QueryHandlerFunc

type QueryHandlerFunc[T any] func(ctx context.Context) (T, error)

func (QueryHandlerFunc[T]) Exec

func (h QueryHandlerFunc[T]) Exec(ctx context.Context) (T, error)

type RequestHandler

type RequestHandler[T any] interface {
	Exec(ctx context.Context, t T) error
}

RequestHandler accepts a request, and returns an error.

type RequestHandlerFunc

type RequestHandlerFunc[T any] func(ctx context.Context, v T) error

func (RequestHandlerFunc[T]) Exec

func (h RequestHandlerFunc[T]) Exec(ctx context.Context, v T) error

func (RequestHandlerFunc[T]) ToCommandHandler

func (h RequestHandlerFunc[T]) ToCommandHandler(ctx context.Context, v T) CommandHandler

type RequestReplyHandler

type RequestReplyHandler[T, U any] interface {
	Exec(ctx context.Context, t T) (U, error)
}

RequestReplyHandler accepts a request, and returns a value and an error.

type RequestReplyHandlerFunc

type RequestReplyHandlerFunc[T, U any] func(ctx context.Context, v T) (U, error)

func (RequestReplyHandlerFunc[T, U]) Exec

func (h RequestReplyHandlerFunc[T, U]) Exec(ctx context.Context, v T) (U, error)

func (RequestReplyHandlerFunc[T, U]) ToQueryHandler

func (h RequestReplyHandlerFunc[T, U]) ToQueryHandler(ctx context.Context, v T) QueryHandler[U]

type SilentHandler

type SilentHandler interface {
	Exec(ctx context.Context)
}

SilentHandler is similar like CommandHandler, but returns no error.

type SilentRequestHandler

type SilentRequestHandler[T any] interface {
	Exec(ctx context.Context, t T)
}

SilentRequestHandler is similar like RequestHandler, but returns no error.

Jump to

Keyboard shortcuts

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