modulepackage
0.0.0-20241027000905-5e451f0e72aa
Repository: https://github.com/more-infra/base.git
Documentation: pkg.go.dev
# README
more-infra/base
The basic structures and design modes which could be used by projects.
It includes many typical and common data structures,functions for basic using.
Packages
name | description |
---|---|
error | basic struct for error interface which has more information wrapped |
runner | background goroutine controller with channel sign and sync.WaitGroup |
status | work status controller such as starting,started,stopping,stopped |
element | item container supports safe thread operations and provides simple features database used, such as index,search |
queue | chan with dynamic capacity |
reactor | reactor design mode for resolving sync locking and concurrent controlling, which is similar to event loop processing |
mcontext | put multiple contexts into one which implements the context.Context interface |
chanpool | do select for multiple channels which is ambiguous |
trigger | pack input elements stream to batch by controlling params or function |
values | strings matcher with multiple regex and wildcard pre-built |
varfmt | format string with variable by custom syntax and variable value provider |
scheduler | dynamic goroutine pool for executing tasks, which could be controlled by custom options |
kv | convert between struct object with tag defined and map[string]interface{} like json/yaml Marshal/Unmarshal do. |
Development
Now, this project is in developing stage, so the code is changing frequently. A new version will be published every week at Friday.
# Packages
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
# Functions
ErrorType return Type field of the Error object, it will return "unknown" when the input is not type of *base.Error.
NewConfigError create an error object with "config" Type.
NewError create an error object wrapped input err, default Type is "unknown", you can set the Type by WithType method later.
NewErrorWithType create an error object wrapped input err with the given Type field.
OriginalError return Err field of the Error object, it will return the input object self when it's not type of *base.Error.
WrapError uses to create a new error object or wrapped exist *base.Error.
# Constants
ErrTypeConfig is a common error type using when the error is happened by config paring or checking.
ErrTypeUnknown is the default value for Error's Type field, set a custom Type By NewErrorWithType or NewErrorType,WithType is recommended.