Status and information

Technical reference of Estado e información.


Symbols

SymbolClassDescription
ServerStoragetypeServerStorage defines a public type of API.
StoragevarStorage it exposes a shared value of the package.
memoryServerStorage.SetfuncSet or replace a value.
memoryServerStorage.GetfuncIt gets the first value associated with a key.
memoryServerStorage.HasfuncIt indicates whether the collection contains the key.
memoryServerStorage.DeletefuncEliminates the value associated with a key.
ServerContexttypeServerContext defines a public type of API.
ServervarServer it exposes a shared value of the package.
ServerContext.ProjectNamefuncReturn the name of the project.
ServerContext.InstanceIDfuncReturns the identifier of the owner instance.
ServerContext.StartedAtfuncReturn the moment of start.
ServerContext.UptimefuncReturns the active time.
ServerContext.HostfuncReturn host and port.
ServerContext.PortfuncReturn the explicit port.
ServerContext.AddressfuncAdd Address.
ServerContext.IsDevelopmentfuncIndicates the state of IsDevelopment.
ServerContext.IsClusteredfuncIndicates the state of IsClustered.
ClusterContext.EnabledfuncIndicates if the capacity is active.
ClusterContext.AdapterfuncReturns the name of the adapter.
ClusterErrortypeClusterError defines a public type of API.
ClusterError.ErrorfuncReturns the textual representation of the error.
ClusterError.UnwrapfuncReturns the underlying error.
ClusterContexttypeClusterContext defines a public type of API.
ClustervarCluster it exposes a shared value of the package.
ClusterContext.WhenfuncSearch a previous handler.

ServerStorage

Declaration:

gox
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:

gox
var Storage ServerStorage = newMemoryServerStorage()

Storage it exposes a shared value of the package.


memoryServerStorage.Set

Declaration:

gox
func (s *memoryServerStorage) Set(key string, value any)

Set or replace a value.

Parameters

ParameterTypeDescription
keystringKey that identifies the value.
valueanyValue to be stored or issued.

Behavior

Replace the values previously associated with the same key.

Usage syntax

gox
memoryServerStorage.Set("key", value)

memoryServerStorage.Get

Declaration:

gox
func (s *memoryServerStorage) Get(key string, out any) (bool, error)

It gets the first value associated with a key.

Parameters

ParameterTypeDescription
keystringKey that identifies the value.
outanyDestination where the result is decoded.

Returns

ReturnTypeDescription
valueboolIt indicates the result of the check.
errerrornil 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

gox
value, err := memoryServerStorage.Get("key", &value)

memoryServerStorage.Has

Declaration:

gox
func (s *memoryServerStorage) Has(key string) bool

It indicates whether the collection contains the key.

Parameters

ParameterTypeDescription
keystringKey that identifies the value.

Returns

ReturnTypeDescription
valueboolIt indicates the result of the check.

Usage syntax

gox
value := memoryServerStorage.Has("key")

memoryServerStorage.Delete

Declaration:

gox
func (s *memoryServerStorage) Delete(key string)

Eliminates the value associated with a key.

Parameters

ParameterTypeDescription
keystringKey that identifies the value.

Behavior

It has no effect when the key does not exist.

Usage syntax

gox
memoryServerStorage.Delete("key")

ServerContext

Declaration:

gox
type ServerContext struct{ state *serverInfoState }

ServerContext defines a public type of API.


Server

Declaration:

gox
var Server = ServerContext{state: &serverInfoState{}}

Server it exposes a shared value of the package.


ServerContext.ProjectName

Declaration:

gox
func (server *ServerContext) ProjectName() string

Return the name of the project.

Returns

ReturnTypeDescription
valuestringTextual value produced by the operation; its zero value is an empty string.

Usage syntax

gox
value := serverContext.ProjectName()

ServerContext.InstanceID

Declaration:

gox
func (server *ServerContext) InstanceID() string

Returns the identifier of the owner instance.

Returns

ReturnTypeDescription
valuestringTextual value produced by the operation; its zero value is an empty string.

Usage syntax

gox
value := serverContext.InstanceID()

ServerContext.StartedAt

Declaration:

gox
func (server *ServerContext) StartedAt() time.Time

Return the moment of start.

Returns

ReturnTypeDescription
valuetime.TimeType value time.Time produced by the operation.

Usage syntax

gox
value := serverContext.StartedAt()

ServerContext.Uptime

Declaration:

gox
func (server *ServerContext) Uptime() time.Duration

Returns the active time.

Returns

ReturnTypeDescription
valuetime.DurationType value time.Duration produced by the operation.

Usage syntax

gox
value := serverContext.Uptime()

ServerContext.Host

Declaration:

gox
func (server *ServerContext) Host() string

Return host and port.

Returns

ReturnTypeDescription
valuestringTextual value produced by the operation; its zero value is an empty string.

Usage syntax

gox
value := serverContext.Host()

ServerContext.Port

Declaration:

gox
func (server *ServerContext) Port() int

Return the explicit port.

Returns

ReturnTypeDescription
valueintType value int produced by the operation.

Usage syntax

gox
value := serverContext.Port()

ServerContext.Address

Declaration:

gox
func (server *ServerContext) Address() string

Add Address.

Returns

ReturnTypeDescription
valuestringTextual value produced by the operation; its zero value is an empty string.

Usage syntax

gox
value := serverContext.Address()

ServerContext.IsDevelopment

Declaration:

gox
func (server *ServerContext) IsDevelopment() bool

Indicates the state of IsDevelopment.

Returns

ReturnTypeDescription
valueboolIt indicates the result of the check.

Usage syntax

gox
value := serverContext.IsDevelopment()

ServerContext.IsClustered

Declaration:

gox
func (server *ServerContext) IsClustered() bool

Indicates the state of IsClustered.

Returns

ReturnTypeDescription
valueboolIt indicates the result of the check.

Usage syntax

gox
value := serverContext.IsClustered()

ClusterContext.Enabled

Declaration:

gox
func (cluster *ClusterContext) Enabled() bool

Indicates if the capacity is active.

Returns

ReturnTypeDescription
valueboolIt indicates the result of the check.

Usage syntax

gox
value := clusterContext.Enabled()

ClusterContext.Adapter

Declaration:

gox
func (cluster *ClusterContext) Adapter() string

Returns the name of the adapter.

Returns

ReturnTypeDescription
valuestringTextual value produced by the operation; its zero value is an empty string.

Usage syntax

gox
value := clusterContext.Adapter()

ClusterError

Declaration:

gox
type ClusterError struct {
	Adapter    string
	Operation  string
	Message    string
	InstanceID string
	Cause      error
}

ClusterError defines a public type of API.

Fields

FieldTypeDescription
AdapterstringName of the adapter.
OperationstringOperation that made the mistake.
MessagestringA descriptive message.
InstanceIDstringAssociated identifier.
Causeerrorunderlying error.

ClusterError.Error

Declaration:

gox
func (err ClusterError) Error() string

Returns the textual representation of the error.

Returns

ReturnTypeDescription
valuestringTextual value produced by the operation; its zero value is an empty string.

Usage syntax

gox
value := clusterError.Error()

ClusterError.Unwrap

Declaration:

gox
func (err ClusterError) Unwrap() error

Returns the underlying error.

Returns

ReturnTypeDescription
errerrornil 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

gox
err := clusterError.Unwrap()

ClusterContext

Declaration:

gox
type ClusterContext struct {
	// contiene campos internos
}

ClusterContext defines a public type of API.


Cluster

Declaration:

gox
var Cluster = ClusterContext{events: newServerEventState(), state: newClusterInfoState()}

Cluster it exposes a shared value of the package.


ClusterContext.When

Declaration:

gox
func (cluster *ClusterContext) When(event string, handler any)

Search a previous handler.

Parameters

ParameterTypeDescription
eventstringName of the event.
handleranyType value any required by the operation.

Usage syntax

gox
clusterContext.When("event", nil)

Next step

Continue with public error types.

Errors