Server sessions

Technical reference of Sesiones del servidor.

This API is used in Sessions configuration.


Symbols

SymbolClassDescription
ErrSessionNotAvailablevarErrSessionNotAvailable it exposes a shared value of the package.
ErrSessionInvalidKeyvarErrSessionInvalidKey it exposes a shared value of the package.
ErrSessionInvalidOutvarErrSessionInvalidOut it exposes a shared value of the package.
ErrSessionExpiredvarErrSessionExpired it exposes a shared value of the package.
SessionConfigtypeSessionConfig defines a public type of API.
SessionStoragetypeSessionStorage defines a public type of API.
SessionStorageConfigtypeSessionStorageConfig defines a public type of API.
SessionStorageRuntimetypeSessionStorageRuntime defines a public type of API.
SessionOpenStatustypeSessionOpenStatus defines a public type of API.
SessionOpenMissingconstSessionOpenMissing defines a constant value of the API.
SessionOpenOpenedconstSessionOpenOpened defines a constant value of the API.
SessionOpenInvalidTokenconstSessionOpenInvalidToken defines a constant value of the API.
SessionOpenExpiredconstSessionOpenExpired defines a constant value of the API.
SessionOpenRequesttypeSessionOpenRequest defines a public type of API.
SessionOpenResulttypeSessionOpenResult defines a public type of API.
SessionOpenResult.OpenedfuncOpen up. Opened.
SessionStorageInstancetypeSessionStorageInstance defines a public type of API.
SessionMetatypeSessionMeta defines a public type of API.
SessionExpireFunctypeSessionExpireFunc defines a public type of API.
SessionEventKindtypeSessionEventKind defines a public type of API.
SessionEventExpiredconstSessionEventExpired defines a constant value of the API.
SessionEventDestroyedconstSessionEventDestroyed defines a constant value of the API.
SessionEventtypeSessionEvent defines a public type of API.
SessionEventFunctypeSessionEventFunc defines a public type of API.
SessionRotateFunctypeSessionRotateFunc defines a public type of API.
SessionDestroyFunctypeSessionDestroyFunc defines a public type of API.
SessionSaveFunctypeSessionSaveFunc defines a public type of API.
SessiontypeSession defines a public type of API.
ExpireSessiontypeExpireSession defines a public type of API.
NewSessionfuncBuild NewSession.
NewSessionReferencefuncBuild NewSessionReference.
NewSessionWithRotatefuncBuild NewSessionWithRotate.
NewSessionWithLifecyclefuncBuild NewSessionWithLifecycle.
DetachSessionfuncIt creates a life-cycle session without callbacks.
Session.IDfuncReturn the identifier.
Session.TokenfuncGive back the session token.
Session.DestroyfuncDestroy the session and block new mutations.
Session.IsDestroyedfuncIndicates the state of IsDestroyed.
NewExpireSessionfuncBuild NewExpireSession.
ExpireSession.IDfuncReturn the identifier.
ExpireSession.TokenfuncGive back the session token.
ExpireSession.CreatedAtfuncCrea CreatedAt.
ExpireSession.LastUpdatefuncReturns the instant of the latest update.
ExpireSession.ExpireAtfuncIt returns the moment of expiry.
ExpireSession.GetfuncIt gets the first value associated with a key.
ExpireSession.HasfuncIt indicates whether the collection contains the key.
ExpireSession.GetAllfuncIt gets all the values associated with a key.
ExpireSession.GetTTLfuncGet it. GetTTL.
Session.GetfuncIt gets the first value associated with a key.
Session.SetfuncSet or replace a value.
Session.HasfuncIt indicates whether the collection contains the key.
Session.GetAllfuncIt gets all the values associated with a key.
Session.DeletefuncEliminates the value associated with a key.
Session.RotatefuncRota Rotate.
Session.ClearfuncClean Clear.
Session.SavefuncThe remaining changes remain.
Session.SetTTLfuncSets SetTTL.
Session.GetTTLfuncGet it. GetTTL.
MemorySessionAdaptertypeMemorySessionAdapter defines a public type of API.
NewMemorySessionAdapterfuncBuild NewMemorySessionAdapter.
MemorySessionStoragefuncReturns the session storage in memory.
MemorySessionAdapter.GetNamefuncGet it. GetName.
MemorySessionAdapter.OpenSessionStoragefuncOpen up. OpenSessionStorage.
SessionTracetypeSessionTrace defines a public type of API.
SessionTraceFieldtypeSessionTraceField defines a public type of API.
SessionTraceStagetypeSessionTraceStage defines a public type of API.
NewSessionTracefuncBuild NewSessionTrace.
SessionTrace.NowfuncReturns the watch used by the track.
SessionTrace.AddfuncAdd Add.
SessionTrace.AddDurationfuncAdd AddDuration.
SessionTrace.AddFieldfuncAdd AddField.
SessionTrace.AddBoolfuncAdd AddBool.
SessionTrace.FieldsfuncGive back a copy of the trace fields.
SessionTrace.StagesfuncReturns a copy of the tracks.

ErrSessionNotAvailable

Declaration:

gox
ErrSessionNotAvailable = errors.New("session is not available")

ErrSessionNotAvailable it exposes a shared value of the package.


ErrSessionInvalidKey

Declaration:

gox
ErrSessionInvalidKey   = errors.New("session key is invalid")

ErrSessionInvalidKey it exposes a shared value of the package.


ErrSessionInvalidOut

Declaration:

gox
ErrSessionInvalidOut   = errors.New("session output target is invalid")

ErrSessionInvalidOut it exposes a shared value of the package.


ErrSessionExpired

Declaration:

gox
ErrSessionExpired      = errors.New("session is expired")

ErrSessionExpired it exposes a shared value of the package.


SessionConfig

Declaration:

gox
type SessionConfig struct {
	TTL      time.Duration
	OnCreate func(session *Session)
	OnExpire func(session *ExpireSession)
}

SessionConfig defines a public type of API.

Fields

FieldTypeDescription
TTLtime.DurationLife time.
OnCreatefunc(session *Session)Public data associated with OnCreate.
OnExpirefunc(session *ExpireSession)Public data associated with OnExpire.

SessionStorage

Declaration:

gox
type SessionStorage interface {
	GetName() string
	OpenSessionStorage(ctx context.Context, config SessionStorageConfig) (SessionStorageRuntime, error)
}

SessionStorage defines a public type of API.


SessionStorageConfig

Declaration:

gox
type SessionStorageConfig struct {
	ProjectName string
	TTL         time.Duration
}

SessionStorageConfig defines a public type of API.

Fields

FieldTypeDescription
ProjectNamestringName of the element.
TTLtime.DurationLife time.

SessionStorageRuntime

Declaration:

gox
type SessionStorageRuntime interface {
	GetName() string
	Close() error

	OpenSession(ctx context.Context, request SessionOpenRequest) (SessionOpenResult, error)
	GetSession(ctx context.Context, sessionID string) (SessionStorageInstance, error)
	CreateSession(ctx context.Context, meta *SessionMeta) (SessionStorageInstance, error)
	SaveSession(ctx context.Context, sessionID string) error
	TouchSession(ctx context.Context, sessionID string, ttl time.Duration) error
	DeleteSession(ctx context.Context, sessionID string) error

	SubscribeSessionEvents(ctx context.Context, fn SessionEventFunc) error
}

SessionStorageRuntime defines a public type of API.


SessionOpenStatus

Declaration:

gox
type SessionOpenStatus uint8

SessionOpenStatus defines a public type of API.


SessionOpenMissing

Declaration:

gox
SessionOpenMissing SessionOpenStatus = iota

SessionOpenMissing defines a constant value of the API.


SessionOpenOpened

Declaration:

gox
SessionOpenOpened

SessionOpenOpened defines a constant value of the API.


SessionOpenInvalidToken

Declaration:

gox
SessionOpenInvalidToken

SessionOpenInvalidToken defines a constant value of the API.


SessionOpenExpired

Declaration:

gox
SessionOpenExpired

SessionOpenExpired defines a constant value of the API.


SessionOpenRequest

Declaration:

gox
type SessionOpenRequest struct {
	ID    string
	Token string
	TTL   time.Duration
	Now   time.Time
	Trace *SessionTrace
}

SessionOpenRequest defines a public type of API.

Fields

FieldTypeDescription
IDstringUnique identifier.
TokenstringToken associate.
TTLtime.DurationLife time.
Nowtime.TimePublic data associated with Now.
Trace*SessionTracePublic data associated with Trace.

SessionOpenResult

Declaration:

gox
type SessionOpenResult struct {
	Status   SessionOpenStatus
	Instance SessionStorageInstance
}

SessionOpenResult defines a public type of API.

Fields

FieldTypeDescription
StatusSessionOpenStatusStatus of the operation.
InstanceSessionStorageInstanceAssociated jurisdiction.

SessionOpenResult.Opened

Declaration:

gox
func (r SessionOpenResult) Opened() bool

Open up. Opened.

Returns

ReturnTypeDescription
valueboolIt indicates the result of the check.

Usage syntax

gox
value := sessionOpenResult.Opened()

SessionStorageInstance

Declaration:

gox
type SessionStorageInstance interface {
	ID() string
	Token() string

	Get(key string, out any) (bool, error)
	Has(key string) bool
	GetAll() map[string]any

	Set(key string, value any) error
	Delete(key string) error

	SetToken(token string) error

	Clear() error

	SetTTL(ttl time.Duration)
	GetTTL() time.Duration
}

SessionStorageInstance defines a public type of API.


SessionMeta

Declaration:

gox
type SessionMeta struct {
	ID        string
	Token     string
	TTL       time.Duration
	ExpireAt  time.Time
	CreatedAt time.Time
	UpdatedAt time.Time
}

SessionMeta defines a public type of API.

Fields

FieldTypeDescription
IDstringUnique identifier.
TokenstringToken associate.
TTLtime.DurationLife time.
ExpireAttime.TimeTime mark.
CreatedAttime.TimeTime mark.
UpdatedAttime.TimeTime mark.

SessionExpireFunc

Declaration:

gox
type SessionExpireFunc func(session *ExpireSession)

SessionExpireFunc defines a public type of API.


SessionEventKind

Declaration:

gox
type SessionEventKind uint8

SessionEventKind defines a public type of API.


SessionEventExpired

Declaration:

gox
SessionEventExpired SessionEventKind = iota + 1

SessionEventExpired defines a constant value of the API.


SessionEventDestroyed

Declaration:

gox
SessionEventDestroyed

SessionEventDestroyed defines a constant value of the API.


SessionEvent

Declaration:

gox
type SessionEvent struct {
	Kind      SessionEventKind
	SessionID string
	Session   *ExpireSession
}

SessionEvent defines a public type of API.

Fields

FieldTypeDescription
KindSessionEventKindEvent or state class.
SessionIDstringAssociated identifier.
Session*ExpireSessionAssociated session.

SessionEventFunc

Declaration:

gox
type SessionEventFunc func(event SessionEvent)

SessionEventFunc defines a public type of API.


SessionRotateFunc

Declaration:

gox
type SessionRotateFunc func() (string, error)

SessionRotateFunc defines a public type of API.


SessionDestroyFunc

Declaration:

gox
type SessionDestroyFunc func() error

SessionDestroyFunc defines a public type of API.


SessionSaveFunc

Declaration:

gox
type SessionSaveFunc func() error

SessionSaveFunc defines a public type of API.


Session

Declaration:

gox
type Session struct {
	// contiene campos internos
}

Session defines a public type of API.


ExpireSession

Declaration:

gox
type ExpireSession struct {
	// contiene campos internos
}

ExpireSession defines a public type of API.


NewSession

Declaration:

gox
func NewSession(instance SessionStorageInstance) Session

Build NewSession.

Parameters

ParameterTypeDescription
instanceSessionStorageInstanceType value SessionStorageInstance required by the operation.

Returns

ReturnTypeDescription
valueSessionType value Session produced by the operation.

Usage syntax

gox
value := server.NewSession(value)

NewSessionReference

Declaration:

gox
func NewSessionReference(id string) Session

Build NewSessionReference.

Parameters

ParameterTypeDescription
idstringType value string required by the operation.

Returns

ReturnTypeDescription
valueSessionType value Session produced by the operation.

Usage syntax

gox
value := server.NewSessionReference("id")

NewSessionWithRotate

Declaration:

gox
func NewSessionWithRotate(instance SessionStorageInstance, rotate SessionRotateFunc) Session

Build NewSessionWithRotate.

Parameters

ParameterTypeDescription
instanceSessionStorageInstanceType value SessionStorageInstance required by the operation.
rotateSessionRotateFuncType value SessionRotateFunc required by the operation.

Returns

ReturnTypeDescription
valueSessionType value Session produced by the operation.

Usage syntax

gox
value := server.NewSessionWithRotate(value, value)

NewSessionWithLifecycle

Declaration:

gox
func NewSessionWithLifecycle(instance SessionStorageInstance, rotate SessionRotateFunc, destroy SessionDestroyFunc, onDestroyed func(), save ...SessionSaveFunc) Session

Build NewSessionWithLifecycle.

Parameters

ParameterTypeDescription
instanceSessionStorageInstanceType value SessionStorageInstance required by the operation.
rotateSessionRotateFuncType value SessionRotateFunc required by the operation.
destroySessionDestroyFuncType value SessionDestroyFunc required by the operation.
onDestroyedfunc()Type value func() required by the operation.
save...SessionSaveFuncType value ...SessionSaveFunc required by the operation.

Returns

ReturnTypeDescription
valueSessionType value Session produced by the operation.

Usage syntax

gox
value := server.NewSessionWithLifecycle(value, value, value, nil, value)

DetachSession

Declaration:

gox
func DetachSession(session Session) Session

It creates a life-cycle session without callbacks.

Parameters

ParameterTypeDescription
sessionSessionType value Session required by the operation.

Returns

ReturnTypeDescription
valueSessionType value Session produced by the operation.

Usage syntax

gox
value := server.DetachSession(value)

Session.ID

Declaration:

gox
func (s *Session) ID() string

Return the identifier.

Returns

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

Usage syntax

gox
value := ctx.Session.ID()

Session.Token

Declaration:

gox
func (s *Session) Token() string

Give back the session token.

Returns

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

Usage syntax

gox
value := ctx.Session.Token()

Session.Destroy

Declaration:

gox
func (s *Session) Destroy() error

Destroy the session and block new mutations.

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

Destroy 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 := ctx.Session.Destroy()

Session.IsDestroyed

Declaration:

gox
func (s *Session) IsDestroyed() bool

Indicates the state of IsDestroyed.

Returns

ReturnTypeDescription
valueboolIt indicates the result of the check.

Usage syntax

gox
value := ctx.Session.IsDestroyed()

NewExpireSession

Declaration:

gox
func NewExpireSession(meta *SessionMeta, instance SessionStorageInstance) ExpireSession

Build NewExpireSession.

Parameters

ParameterTypeDescription
meta*SessionMetaType value *SessionMeta required by the operation.
instanceSessionStorageInstanceType value SessionStorageInstance required by the operation.

Returns

ReturnTypeDescription
valueExpireSessionType value ExpireSession produced by the operation.

Usage syntax

gox
value := server.NewExpireSession(nil, value)

ExpireSession.ID

Declaration:

gox
func (s *ExpireSession) ID() string

Return the identifier.

Returns

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

Usage syntax

gox
value := expireSession.ID()

ExpireSession.Token

Declaration:

gox
func (s *ExpireSession) Token() string

Give back the session token.

Returns

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

Usage syntax

gox
value := expireSession.Token()

ExpireSession.CreatedAt

Declaration:

gox
func (s *ExpireSession) CreatedAt() time.Time

Crea CreatedAt.

Returns

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

Usage syntax

gox
value := expireSession.CreatedAt()

ExpireSession.LastUpdate

Declaration:

gox
func (s *ExpireSession) LastUpdate() time.Time

Returns the instant of the latest update.

Returns

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

Usage syntax

gox
value := expireSession.LastUpdate()

ExpireSession.ExpireAt

Declaration:

gox
func (s *ExpireSession) ExpireAt() time.Time

It returns the moment of expiry.

Returns

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

Usage syntax

gox
value := expireSession.ExpireAt()

ExpireSession.Get

Declaration:

gox
func (s *ExpireSession) 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 := expireSession.Get("key", &value)

ExpireSession.Has

Declaration:

gox
func (s *ExpireSession) 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 := expireSession.Has("key")

ExpireSession.GetAll

Declaration:

gox
func (s *ExpireSession) GetAll() map[string]any

It gets all the values associated with a key.

Returns

ReturnTypeDescription
valuemap[string]anyType value map[string]any produced by the operation.

Behavior

The returned slice is independent of the collection. When the key does not exist, it returns nil and false.

Usage syntax

gox
value := expireSession.GetAll()

ExpireSession.GetTTL

Declaration:

gox
func (s *ExpireSession) GetTTL() time.Duration

Get it. GetTTL.

Returns

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

Usage syntax

gox
value := expireSession.GetTTL()

Session.Get

Declaration:

gox
func (s *Session) 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 := ctx.Session.Get("key", &value)

Session.Set

Declaration:

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

Set or replace a value.

Parameters

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

Returns

ReturnTypeDescription
errerrornil if the operation ends correctly; otherwise, the error produced.

Behavior

Replace the values previously associated with the same key.

Errors

Set 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 := ctx.Session.Set("key", value)

Session.Has

Declaration:

gox
func (s *Session) 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 := ctx.Session.Has("key")

Session.GetAll

Declaration:

gox
func (s *Session) GetAll() map[string]any

It gets all the values associated with a key.

Returns

ReturnTypeDescription
valuemap[string]anyType value map[string]any produced by the operation.

Behavior

The returned slice is independent of the collection. When the key does not exist, it returns nil and false.

Usage syntax

gox
value := ctx.Session.GetAll()

Session.Delete

Declaration:

gox
func (s *Session) Delete(key string) error

Eliminates the value associated with a key.

Parameters

ParameterTypeDescription
keystringKey that identifies the value.

Returns

ReturnTypeDescription
errerrornil if the operation ends correctly; otherwise, the error produced.

Behavior

It has no effect when the key does not exist.

Errors

Delete 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 := ctx.Session.Delete("key")

Session.Rotate

Declaration:

gox
func (s *Session) Rotate() error

Rota Rotate.

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

Rotate 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 := ctx.Session.Rotate()

Session.Clear

Declaration:

gox
func (s *Session) Clear() error

Clean Clear.

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

Clear 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 := ctx.Session.Clear()

Session.Save

Declaration:

gox
func (s *Session) Save() error

The remaining changes remain.

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

Save 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 := ctx.Session.Save()

Session.SetTTL

Declaration:

gox
func (s *Session) SetTTL(ttl time.Duration)

Sets SetTTL.

Parameters

ParameterTypeDescription
ttltime.DurationLife time.

Usage syntax

gox
ctx.Session.SetTTL(time.Hour)

Session.GetTTL

Declaration:

gox
func (s *Session) GetTTL() time.Duration

Get it. GetTTL.

Returns

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

Usage syntax

gox
value := ctx.Session.GetTTL()

MemorySessionAdapter

Declaration:

gox
type MemorySessionAdapter struct{}

MemorySessionAdapter defines a public type of API.


NewMemorySessionAdapter

Declaration:

gox
func NewMemorySessionAdapter() SessionStorage

Build NewMemorySessionAdapter.

Returns

ReturnTypeDescription
valueSessionStorageType value SessionStorage produced by the operation.

Usage syntax

gox
value := server.NewMemorySessionAdapter()

MemorySessionStorage

Declaration:

gox
func MemorySessionStorage() SessionStorage

Returns the session storage in memory.

Returns

ReturnTypeDescription
valueSessionStorageType value SessionStorage produced by the operation.

Usage syntax

gox
value := server.MemorySessionStorage()

MemorySessionAdapter.GetName

Declaration:

gox
func (MemorySessionAdapter) GetName() string

Get it. GetName.

Returns

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

Usage syntax

gox
value := memorySessionAdapter.GetName()

MemorySessionAdapter.OpenSessionStorage

Declaration:

gox
func (MemorySessionAdapter) OpenSessionStorage(ctx context.Context, config SessionStorageConfig) (SessionStorageRuntime, error)

Open up. OpenSessionStorage.

Parameters

ParameterTypeDescription
ctxcontext.ContextContext of execution.
configSessionStorageConfigType value SessionStorageConfig required by the operation.

Returns

ReturnTypeDescription
valueSessionStorageRuntimeType value SessionStorageRuntime produced by the operation.
errerrornil if the operation ends correctly; otherwise, the error produced.

Behavior

The operation returns an error when it cannot complete the above contract.

Errors

OpenSessionStorage 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 := memorySessionAdapter.OpenSessionStorage(ctx, value)

SessionTrace

Declaration:

gox
type SessionTrace struct {
	Enabled bool
}

SessionTrace defines a public type of API.

Fields

FieldTypeDescription
EnabledboolActivate or disable the function.

SessionTraceField

Declaration:

gox
type SessionTraceField struct {
	Name  string
	Value string
}

SessionTraceField defines a public type of API.

Fields

FieldTypeDescription
NamestringName of the value.
ValuestringValue stored.

SessionTraceStage

Declaration:

gox
type SessionTraceStage struct {
	Name     string
	Duration time.Duration
}

SessionTraceStage defines a public type of API.

Fields

FieldTypeDescription
NamestringName of the value.
Durationtime.DurationLength recorded.

NewSessionTrace

Declaration:

gox
func NewSessionTrace(enabled bool) *SessionTrace

Build NewSessionTrace.

Parameters

ParameterTypeDescription
enabledboolType value bool required by the operation.

Returns

ReturnTypeDescription
value*SessionTraceType value *SessionTrace produced by the operation.

Usage syntax

gox
value := server.NewSessionTrace(value)

SessionTrace.Now

Declaration:

gox
func (t *SessionTrace) Now() time.Time

Returns the watch used by the track.

Returns

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

Usage syntax

gox
value := sessionTrace.Now()

SessionTrace.Add

Declaration:

gox
func (t *SessionTrace) Add(name string, started time.Time)

Add Add.

Parameters

ParameterTypeDescription
namestringName assigned.
startedtime.TimeType value time.Time required by the operation.

Usage syntax

gox
sessionTrace.Add("name", value)

SessionTrace.AddDuration

Declaration:

gox
func (t *SessionTrace) AddDuration(name string, duration time.Duration)

Add AddDuration.

Parameters

ParameterTypeDescription
namestringName assigned.
durationtime.DurationType value time.Duration required by the operation.

Usage syntax

gox
sessionTrace.AddDuration("name", value)

SessionTrace.AddField

Declaration:

gox
func (t *SessionTrace) AddField(name string, value string)

Add AddField.

Parameters

ParameterTypeDescription
namestringName assigned.
valuestringValue to be stored or issued.

Usage syntax

gox
sessionTrace.AddField("name", value)

SessionTrace.AddBool

Declaration:

gox
func (t *SessionTrace) AddBool(name string, value bool)

Add AddBool.

Parameters

ParameterTypeDescription
namestringName assigned.
valueboolValue to be stored or issued.

Usage syntax

gox
sessionTrace.AddBool("name", value)

SessionTrace.Fields

Declaration:

gox
func (t *SessionTrace) Fields() []SessionTraceField

Give back a copy of the trace fields.

Returns

ReturnTypeDescription
value[]SessionTraceFieldResult collection; can be nil when there are no values.

Usage syntax

gox
value := sessionTrace.Fields()

SessionTrace.Stages

Declaration:

gox
func (t *SessionTrace) Stages() []SessionTraceStage

Returns a copy of the tracks.

Returns

ReturnTypeDescription
value[]SessionTraceStageResult collection; can be nil when there are no values.

Usage syntax

gox
value := sessionTrace.Stages()

See also

Next step

Continue with cluster contracts.

Cluster