pb

package
v2.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PubSub

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

func NewPubSub

func NewPubSub(ctx context.Context, opts *PubSubOptions) (*PubSub, error)

func (*PubSub) Close

func (p *PubSub) Close() error

func (*PubSub) CreateSubscription

func (p *PubSub) CreateSubscription(id string, sid string, fltr string, cfg ...pubsub.SubscriptionConfig) error

func (*PubSub) CreateSubscriptions

func (p *PubSub) CreateSubscriptions(id string, sids map[string]string, cfg ...pubsub.SubscriptionConfig) error

func (*PubSub) CreateTopic

func (p *PubSub) CreateTopic(id string, cfg ...pubsub.TopicConfig) error

func (*PubSub) Publish

func (p *PubSub) Publish(id string, d any, attrs ...map[string]string) error

func (*PubSub) Receive

func (p *PubSub) Receive(id string, mc chan<- *pubsub.Message) error

type PubSubOptions

type PubSubOptions struct {
	AutoOriginatedAt bool
	ProjectID        string
	ClientOptions    []option.ClientOption
	PublishSettings  pubsub.PublishSettings
	ReceiveSettings  pubsub.ReceiveSettings
}

PubSubOptions provides a way to configure the PubSub client with various options such as the project ID, client options, and publish and receive settings.

func Options

func Options(pID string, opts ...option.ClientOption) *PubSubOptions

Options returns a new PubSubOptions struct with the provided project ID and client options. The AutoOriginatedAt field is set to true by default. Any ClientOptions provided are passed directly through to the underlying pubsub.Client when calling the NewPubSub function.

func (*PubSubOptions) SetAutoOriginatedAt

func (o *PubSubOptions) SetAutoOriginatedAt(auto bool) *PubSubOptions

SetAutoOriginatedAt sets the AutoOriginatedAt field on the PubSubOptions struct to the provided value and returns the modified PubSubOptions struct. If true, the OriginatedAt attribute will be set to the current time if it is not already set for all messages published.

func (*PubSubOptions) SetClientOptions

func (o *PubSubOptions) SetClientOptions(opts ...option.ClientOption) *PubSubOptions

SetClientOptions sets the ClientOptions field on the PubSubOptions struct to the provided options and returns the modified PubSubOptions struct.

func (*PubSubOptions) SetProjectID

func (o *PubSubOptions) SetProjectID(pID string) *PubSubOptions

SetProjectID sets the ProjectID field on the PubSubOptions struct to the provided value and returns the modified PubSubOptions struct.

func (*PubSubOptions) SetPublishSettings

func (o *PubSubOptions) SetPublishSettings(s pubsub.PublishSettings) *PubSubOptions

SetPublishSettings sets the PublishSettings field on the PubSubOptions struct to the provided settings and returns the modified PubSubOptions struct.

func (*PubSubOptions) SetReceiveSettings

func (o *PubSubOptions) SetReceiveSettings(s pubsub.ReceiveSettings) *PubSubOptions

SetReceiveSettings sets the ReceiveSettings field on the PubSubOptions struct to the provided settings and returns the modified PubSubOptions struct.

Jump to

Keyboard shortcuts

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