Documentation ¶
Index ¶
- func DockerUtils() (du *dockerUtils)
- func HashUtils() *hashUtils
- func JsonUtils() *jsonUtils
- func RecoverAll(cb func(v any))
- func RecoverAny(errors []error, cb func(v any))
- func RecoverOne(e error, cb func(v any))
- func SetAPISecret(secret, vector string) error
- func SetJWTSecret(secret string) error
- func TokenUtils() *tokenUtils
- type DockerContainer
- func (c *DockerContainer) AutoRemove(value bool) *DockerContainer
- func (c *DockerContainer) EntryPoint(args ...string) *DockerContainer
- func (c *DockerContainer) Exists() bool
- func (c *DockerContainer) IsRunning() bool
- func (c *DockerContainer) Label(label, value string) *DockerContainer
- func (c *DockerContainer) Labels(label map[string]string) *DockerContainer
- func (c *DockerContainer) Name(value string) *DockerContainer
- func (c *DockerContainer) Port(external, internal string) *DockerContainer
- func (c *DockerContainer) Ports(ports map[string]string) *DockerContainer
- func (c *DockerContainer) Run() error
- func (c *DockerContainer) Stop() error
- func (c *DockerContainer) Var(key, value string) *DockerContainer
- func (c *DockerContainer) Vars(vars map[string]string) *DockerContainer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DockerUtils ¶ added in v1.1.5
func DockerUtils() (du *dockerUtils)
DockerUtils is a simple utility to execute docker commands using shell This utility does not us the docker client library (due to compatability issues) but instead utilizes the shell command executor (from os/exec package). The pre-requisite
func HashUtils ¶
func HashUtils() *hashUtils
HashUtils is a factory method that acts as a static member
func RecoverAll ¶
func RecoverAll(cb func(v any))
RecoverAll performs recover for all panics.
Sample usage:
defer RecoverAll(func(err any) { fmt.Printf("got error: %s", err) })
func RecoverAny ¶
RecoverAny calls the callback function: cb with recovered value in case when recovered value exists in slice errors.
Sample usage:
defer recover.Any([]error{ErrorUsernameBlank, ErrorUsernameAlreadyTaken}, func(err any) { fmt.Printf("got error: %s", err) })
func RecoverOne ¶
RecoverOne calls the callback function: cb with recovered value in case when recovered value equals to e otherwise panic won't be recovered and will be propagated.
Sample usage:
defer recover.One(ErrorUsernameBlank, func(err any) { fmt.Printf("got error: %s", err) })
func SetAPISecret ¶ added in v1.1.2
SetAPISecret set the secret key and initializing vector to encode/decode API keys
func SetJWTSecret ¶ added in v1.1.2
SetJWTSecret set the private key to sign JWT token
func TokenUtils ¶ added in v1.1.2
func TokenUtils() *tokenUtils
TokenUtils is a factory method that acts as a static member
Types ¶
type DockerContainer ¶ added in v1.1.5
type DockerContainer struct {
// contains filtered or unexported fields
}
DockerContainer is used to construct docker container spec for the docker engine.
func (*DockerContainer) AutoRemove ¶ added in v1.1.5
func (c *DockerContainer) AutoRemove(value bool) *DockerContainer
AutoRemove determines whether to automatically remove the container when it has stopped
func (*DockerContainer) EntryPoint ¶ added in v1.1.5
func (c *DockerContainer) EntryPoint(args ...string) *DockerContainer
EntryPoint sets the entrypoint arguments of the container.
func (*DockerContainer) Exists ¶ added in v1.1.5
func (c *DockerContainer) Exists() bool
Exists return true if the container exists
func (*DockerContainer) IsRunning ¶ added in v1.1.7
func (c *DockerContainer) IsRunning() bool
IsRunning return true if the container exists and running
func (*DockerContainer) Label ¶ added in v1.1.5
func (c *DockerContainer) Label(label, value string) *DockerContainer
Label adds custom label
func (*DockerContainer) Labels ¶ added in v1.1.5
func (c *DockerContainer) Labels(label map[string]string) *DockerContainer
Labels adds multiple labels
func (*DockerContainer) Name ¶ added in v1.1.5
func (c *DockerContainer) Name(value string) *DockerContainer
Name sets the container name.
func (*DockerContainer) Port ¶ added in v1.1.5
func (c *DockerContainer) Port(external, internal string) *DockerContainer
Port adds a port mapping
func (*DockerContainer) Ports ¶ added in v1.1.5
func (c *DockerContainer) Ports(ports map[string]string) *DockerContainer
Ports adds multiple port mappings
func (*DockerContainer) Run ¶ added in v1.1.5
func (c *DockerContainer) Run() error
Run builds and run command
func (*DockerContainer) Stop ¶ added in v1.1.5
func (c *DockerContainer) Stop() error
Stop and kill container
func (*DockerContainer) Var ¶ added in v1.1.5
func (c *DockerContainer) Var(key, value string) *DockerContainer
Var adds an environment variable
func (*DockerContainer) Vars ¶ added in v1.1.5
func (c *DockerContainer) Vars(vars map[string]string) *DockerContainer
Vars adds multiple environment variables
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package cache Cache item implementation Based on https://github.com/ReneKroon/ttlcache
|
Package cache Cache item implementation Based on https://github.com/ReneKroon/ttlcache |