Status and information
Technical reference of Estado e información.
Symbols
| Symbol | Class | Description |
|---|---|---|
| ServerStorage | type | ServerStorage defines a public type of API. |
| Storage | var | Storage it exposes a shared value of the package. |
| memoryServerStorage.Set | func | Set or replace a value. |
| memoryServerStorage.Get | func | It gets the first value associated with a key. |
| memoryServerStorage.Has | func | It indicates whether the collection contains the key. |
| memoryServerStorage.Delete | func | Eliminates the value associated with a key. |
| ServerContext | type | ServerContext defines a public type of API. |
| Server | var | Server it exposes a shared value of the package. |
| ServerContext.ProjectName | func | Return the name of the project. |
| ServerContext.InstanceID | func | Returns the identifier of the owner instance. |
| ServerContext.StartedAt | func | Return the moment of start. |
| ServerContext.Uptime | func | Returns the active time. |
| ServerContext.Host | func | Return host and port. |
| ServerContext.Port | func | Return the explicit port. |
| ServerContext.Address | func | Add Address. |
| ServerContext.IsDevelopment | func | Indicates the state of IsDevelopment. |
| ServerContext.IsClustered | func | Indicates the state of IsClustered. |
| ClusterContext.Enabled | func | Indicates if the capacity is active. |
| ClusterContext.Adapter | func | Returns the name of the adapter. |
| ClusterError | type | ClusterError defines a public type of API. |
| ClusterError.Error | func | Returns the textual representation of the error. |
| ClusterError.Unwrap | func | Returns the underlying error. |
| ClusterContext | type | ClusterContext defines a public type of API. |
| Cluster | var | Cluster it exposes a shared value of the package. |
| ClusterContext.When | func | Search a previous handler. |
ServerStorage
Declaration:
type ServerStorage interface {
Set(key string, value any)
Get(key string, out any) (bool, error)
Has(key string) bool
Delete(key string)
} ServerStorage defines a public type of API.
Storage
Declaration:
var Storage ServerStorage = newMemoryServerStorage() Storage it exposes a shared value of the package.
memoryServerStorage.Set
Declaration:
func (s *memoryServerStorage) Set(key string, value any) Set or replace a value.
Parameters
| Parameter | Type | Description |
|---|---|---|
key | string | Key that identifies the value. |
value | any | Value to be stored or issued. |
Behavior
Replace the values previously associated with the same key.
Usage syntax
memoryServerStorage.Set("key", value) memoryServerStorage.Get
Declaration:
func (s *memoryServerStorage) Get(key string, out any) (bool, error) It gets the first value associated with a key.
Parameters
| Parameter | Type | Description |
|---|---|---|
key | string | Key that identifies the value. |
out | any | Destination where the result is decoded. |
Returns
| Return | Type | Description |
|---|---|---|
value | bool | It indicates the result of the check. |
err | error | nil if the operation ends correctly; otherwise, the error produced. |
Behavior
When the key does not exist, it returns the zero value of T and false.
Errors
Get returns an error when the arguments, the status of the receiver or the underlying operation make it impossible to complete the call.
Usage syntax
value, err := memoryServerStorage.Get("key", &value) memoryServerStorage.Has
Declaration:
func (s *memoryServerStorage) Has(key string) bool It indicates whether the collection contains the key.
Parameters
| Parameter | Type | Description |
|---|---|---|
key | string | Key that identifies the value. |
Returns
| Return | Type | Description |
|---|---|---|
value | bool | It indicates the result of the check. |
Usage syntax
value := memoryServerStorage.Has("key") memoryServerStorage.Delete
Declaration:
func (s *memoryServerStorage) Delete(key string) Eliminates the value associated with a key.
Parameters
| Parameter | Type | Description |
|---|---|---|
key | string | Key that identifies the value. |
Behavior
It has no effect when the key does not exist.
Usage syntax
memoryServerStorage.Delete("key") ServerContext
Declaration:
type ServerContext struct{ state *serverInfoState } ServerContext defines a public type of API.
Server
Declaration:
var Server = ServerContext{state: &serverInfoState{}} Server it exposes a shared value of the package.
ServerContext.ProjectName
Declaration:
func (server *ServerContext) ProjectName() string Return the name of the project.
Returns
| Return | Type | Description |
|---|---|---|
value | string | Textual value produced by the operation; its zero value is an empty string. |
Usage syntax
value := serverContext.ProjectName() ServerContext.InstanceID
Declaration:
func (server *ServerContext) InstanceID() string Returns the identifier of the owner instance.
Returns
| Return | Type | Description |
|---|---|---|
value | string | Textual value produced by the operation; its zero value is an empty string. |
Usage syntax
value := serverContext.InstanceID() ServerContext.StartedAt
Declaration:
func (server *ServerContext) StartedAt() time.Time Return the moment of start.
Returns
| Return | Type | Description |
|---|---|---|
value | time.Time | Type value time.Time produced by the operation. |
Usage syntax
value := serverContext.StartedAt() ServerContext.Uptime
Declaration:
func (server *ServerContext) Uptime() time.Duration Returns the active time.
Returns
| Return | Type | Description |
|---|---|---|
value | time.Duration | Type value time.Duration produced by the operation. |
Usage syntax
value := serverContext.Uptime() ServerContext.Host
Declaration:
func (server *ServerContext) Host() string Return host and port.
Returns
| Return | Type | Description |
|---|---|---|
value | string | Textual value produced by the operation; its zero value is an empty string. |
Usage syntax
value := serverContext.Host() ServerContext.Port
Declaration:
func (server *ServerContext) Port() int Return the explicit port.
Returns
| Return | Type | Description |
|---|---|---|
value | int | Type value int produced by the operation. |
Usage syntax
value := serverContext.Port() ServerContext.Address
Declaration:
func (server *ServerContext) Address() string Add Address.
Returns
| Return | Type | Description |
|---|---|---|
value | string | Textual value produced by the operation; its zero value is an empty string. |
Usage syntax
value := serverContext.Address() ServerContext.IsDevelopment
Declaration:
func (server *ServerContext) IsDevelopment() bool Indicates the state of IsDevelopment.
Returns
| Return | Type | Description |
|---|---|---|
value | bool | It indicates the result of the check. |
Usage syntax
value := serverContext.IsDevelopment() ServerContext.IsClustered
Declaration:
func (server *ServerContext) IsClustered() bool Indicates the state of IsClustered.
Returns
| Return | Type | Description |
|---|---|---|
value | bool | It indicates the result of the check. |
Usage syntax
value := serverContext.IsClustered() ClusterContext.Enabled
Declaration:
func (cluster *ClusterContext) Enabled() bool Indicates if the capacity is active.
Returns
| Return | Type | Description |
|---|---|---|
value | bool | It indicates the result of the check. |
Usage syntax
value := clusterContext.Enabled() ClusterContext.Adapter
Declaration:
func (cluster *ClusterContext) Adapter() string Returns the name of the adapter.
Returns
| Return | Type | Description |
|---|---|---|
value | string | Textual value produced by the operation; its zero value is an empty string. |
Usage syntax
value := clusterContext.Adapter() ClusterError
Declaration:
type ClusterError struct {
Adapter string
Operation string
Message string
InstanceID string
Cause error
} ClusterError defines a public type of API.
Fields
| Field | Type | Description |
|---|---|---|
Adapter | string | Name of the adapter. |
Operation | string | Operation that made the mistake. |
Message | string | A descriptive message. |
InstanceID | string | Associated identifier. |
Cause | error | underlying error. |
ClusterError.Error
Declaration:
func (err ClusterError) Error() string Returns the textual representation of the error.
Returns
| Return | Type | Description |
|---|---|---|
value | string | Textual value produced by the operation; its zero value is an empty string. |
Usage syntax
value := clusterError.Error() ClusterError.Unwrap
Declaration:
func (err ClusterError) Unwrap() error Returns the underlying error.
Returns
| Return | Type | Description |
|---|---|---|
err | error | nil if the operation ends correctly; otherwise, the error produced. |
Behavior
The operation returns an error when it cannot complete the above contract.
Errors
Unwrap returns an error when the arguments, the status of the receiver or the underlying operation make it impossible to complete the call.
Usage syntax
err := clusterError.Unwrap() ClusterContext
Declaration:
type ClusterContext struct {
// contiene campos internos
} ClusterContext defines a public type of API.
Cluster
Declaration:
var Cluster = ClusterContext{events: newServerEventState(), state: newClusterInfoState()} Cluster it exposes a shared value of the package.
ClusterContext.When
Declaration:
func (cluster *ClusterContext) When(event string, handler any) Search a previous handler.
Parameters
| Parameter | Type | Description |
|---|---|---|
event | string | Name of the event. |
handler | any | Type value any required by the operation. |
Usage syntax
clusterContext.When("event", nil)