Documentation ¶
Index ¶
- func CheckDNS(domain string) errors.Error
- func CheckNetwork(host, port string, timeout time.Duration) errors.Error
- func Convert[T any](value any) (T, errors.Error)
- func CreateCmd(args ...string) *exec.Cmd
- func CreateGZipArchive(archivePath string, sourcePaths ...string) errors.Error
- func CreateZipArchive(archivePath string, sourcePaths ...string) errors.Error
- func GatherCallFrames(delta int) string
- func GetEncodedToken(username string, password string) string
- func GetItem[T any](array JsonArray, index int) (T, errors.Error)
- func GetProperty[T any](object JsonObject, key string) (T, errors.Error)
- func RandLetterBytes(n int) (string, errors.Error)
- func RecoverToError() error
- func ResolvePort(port string, schema string) (string, errors.Error)
- func SliceRemove[T ~int | ~string](source []T, toRemoves ...T) []T
- func StrToBoolOr(text string, defaultValue bool) (bool, errors.Error)
- func StrToDurationOr(text string, defaultValue time.Duration) (time.Duration, errors.Error)
- func StrToIntOr(text string, defaultValue int) (int, errors.Error)
- func StringsContains(slice []string, target string) bool
- func StringsUniq(source []string) []string
- func WalkFields(t reflect.Type, filter func(field *reflect.StructField) bool) (f []reflect.StructField)
- type JsonArray
- type JsonObject
- type ProcessResponse
- type ProcessStream
- type RunProcessOptions
- type StreamProcessOptions
- type TableInfoChecker
- type TableInfoCheckerConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckNetwork ¶
CheckNetwork FIXME ...
func Convert ¶
Convert converts value to type T. If value is a slice, it converts each element of the slice to type T. Does not support nested slices.
func CreateGZipArchive ¶
CreateGZipArchive creates a tar archive, compresses it with gzip and writes the files/directories associated with the `sourcePaths` to it. If a sourcePath directory ends with /*, then its contents are copied over, but not the directory itself
func CreateZipArchive ¶
CreateZipArchive creates a zip archive and writes the files/directories associated with the `sourcePaths` to it. If a sourcePath directory ends with /*, then its contents are copied over, but not the directory itself
func GetEncodedToken ¶
GetEncodedToken FIXME ...
func GetProperty ¶
func GetProperty[T any](object JsonObject, key string) (T, errors.Error)
func RandLetterBytes ¶
RandLetterBytes returns a cryptographically secure random string with given length n
func RecoverToError ¶
func RecoverToError() error
RecoverToError call the recover to catch the panic and changed it to be an error
func ResolvePort ¶
ResolvePort FIXME ...
func SliceRemove ¶
SliceRemove remove some items in old slice
func StrToBoolOr ¶
StrToBoolOr Return defaultValue if text is empty, or try to convert it to bool
func StrToDurationOr ¶
StrToDurationOr Return defaultValue if text is empty, or try to convert it to time.Duration
func StrToIntOr ¶
StrToIntOr Return defaultValue if text is empty, or try to convert it to int
func StringsContains ¶
StringsContains checks if `source` String Slice contains `target` string
func StringsUniq ¶
StringsUniq returns a new String Slice contains deduped elements from `source`
func WalkFields ¶
func WalkFields(t reflect.Type, filter func(field *reflect.StructField) bool) (f []reflect.StructField)
WalkFields get the field data by tag
Types ¶
type JsonObject ¶
type ProcessResponse ¶
type ProcessResponse struct {
// contains filtered or unexported fields
}
ProcessResponse wraps output of a process
func RunProcess ¶
func RunProcess(cmd *exec.Cmd, opts *RunProcessOptions) (*ProcessResponse, errors.Error)
RunProcess runs the cmd and blocks until its completion. All returned results will have type []byte.
func (*ProcessResponse) GetError ¶
func (resp *ProcessResponse) GetError() errors.Error
GetError gets the error on the response
func (*ProcessResponse) GetFdOut ¶
func (resp *ProcessResponse) GetFdOut() []byte
func (*ProcessResponse) GetStderr ¶
func (resp *ProcessResponse) GetStderr() []byte
func (*ProcessResponse) GetStdout ¶
func (resp *ProcessResponse) GetStdout() []byte
type ProcessStream ¶
type ProcessStream struct {
// contains filtered or unexported fields
}
ProcessStream wraps output of a process
func StreamProcess ¶
func StreamProcess(cmd *exec.Cmd, opts *StreamProcessOptions) (*ProcessStream, errors.Error)
StreamProcess runs the cmd and returns its output on a line-by-line basis, on a channel. The converter functor will allow you to convert the incoming raw to your custom data type T. This is a nonblocking function.
func (*ProcessStream) Cancel ¶
func (p *ProcessStream) Cancel() errors.Error
Cancel cancels the stream by sending a termination signal to the target.
func (*ProcessStream) Receive ¶
func (p *ProcessStream) Receive() <-chan *ProcessResponse
Receive listens to the process retrieval channel
type RunProcessOptions ¶
type RunProcessOptions struct { OnStdout func(b []byte) OnStderr func(b []byte) UseFdOut bool OnFdOut func(b []byte) }
RunProcessOptions options for running a process
type StreamProcessOptions ¶
type StreamProcessOptions struct { OnStdout func(b []byte) OnStderr func(b []byte) // UseFdOut if true, it'll open this fd to be used by the child process. Useful to isolate stdout and custom outputs UseFdOut bool OnFdOut func(b []byte) }
StreamProcessOptions options for streaming a process
type TableInfoChecker ¶
type TableInfoChecker struct {
// contains filtered or unexported fields
}
func NewTableInfoChecker ¶
func NewTableInfoChecker(cfg TableInfoCheckerConfig) *TableInfoChecker
func (*TableInfoChecker) FeedIn ¶
func (checker *TableInfoChecker) FeedIn(modelsDir string, f func() []dal.Tabler, additionalIgnorablePackages ...string)
The FeedIn function iterates through the model definitions, identifies all the tables by parsing the source files, and then compares them with the output obtained from the GetTablesInfo function. If the plugin has no models directory, pass in the root directory of the plugin
func (*TableInfoChecker) Verify ¶
func (checker *TableInfoChecker) Verify() errors.Error