session

package
v0.14.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 7, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultReceiveTimeout = 10 * time.Second

Variables

View Source
var ErrContextDone = errors.New("context done")

ErrContextDone is returned when the context is done.

View Source
var ErrNilMessage = errors.New("received message is nil")

ErrNilMessage is returned when a nil message is received.

View Source
var ErrTimeout = errors.New("session timeout")

ErrTimeout is returned when a session receive operation times out.

Functions

This section is empty.

Types

type Marshaller

type Marshaller interface {
	Marshal(v any) ([]byte, error)
	Unmarshal(data []byte, v any) error
}

Marshaller is a generic interface for marshalling and unmarshalling data.

type S

type S struct {
	// contains filtered or unexported fields
}

func New

func New(s Session, ctx context.Context, m Marshaller) *S

func (*S) Info

func (j *S) Info() view.SessionInfo

func (*S) Receive

func (j *S) Receive(state any) error

func (*S) ReceiveRaw

func (j *S) ReceiveRaw() ([]byte, error)

func (*S) ReceiveRawWithTimeout

func (j *S) ReceiveRawWithTimeout(d time.Duration) ([]byte, error)

func (*S) ReceiveWithTimeout

func (j *S) ReceiveWithTimeout(state any, d time.Duration) error

func (*S) Send

func (j *S) Send(state any) error

func (*S) SendError

func (j *S) SendError(err string) error

func (*S) SendErrorWithContext

func (j *S) SendErrorWithContext(ctx context.Context, err string) error

func (*S) SendRaw

func (j *S) SendRaw(ctx context.Context, raw []byte) error

func (*S) SendWithContext

func (j *S) SendWithContext(ctx context.Context, state any) error

func (*S) Session

func (j *S) Session() Session

type Session

type Session = view.Session

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL