goms

package module
v0.0.0-...-7346868 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrConnectionClosed = errors.New("goms: connection closed")
	ErrSyncSubRequired  = errors.New("goms: illegal call on an async subscription")
)

Errors.

Functions

func Drivers

func Drivers() []string

Drivers returns a sorted list of the names of the registered drivers.

func Register

func Register(name string, driver driver.Driver)

Register makes a database driver available by the provided name. If Register is called twice with the same name or if driver is nil, it panics.

Types

type Conn

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

func Connect

func Connect(ctx context.Context, driverName, dataSourceName string) (*Conn, error)

func (*Conn) Close

func (c *Conn) Close() error

func (*Conn) Driver

func (c *Conn) Driver() string

func (*Conn) Publish

func (c *Conn) Publish(ctx context.Context, topic string, data []byte) error

func (*Conn) Subscribe

func (c *Conn) Subscribe(topic string, h func(*Message)) (*Subscription, error)

func (*Conn) SubscribeChan

func (c *Conn) SubscribeChan(topic string, queue chan *Message) (*Subscription, error)

func (*Conn) SubscribeSync

func (c *Conn) SubscribeSync(topic string) (*Subscription, error)

type Message

type Message struct {
	Topic    string
	Data     []byte
	Metadata map[string]string
}

type Subscription

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

func (*Subscription) Close

func (s *Subscription) Close() error

func (*Subscription) Receive

func (s *Subscription) Receive(ctx context.Context) (*Message, error)

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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