Documentation ¶
Index ¶
- Constants
- Variables
- func Connect(uri, username, password, database string) error
- func DeleteChannel(ctx context.Context, id int64) error
- func EnsureCollection(coll string)
- func GetChannel(ctx context.Context, filter bson.D) (*types.Channel, error)
- func GetChannels(ctx context.Context, cb func([]types.Channel), batchSize int) error
- func InsertChannel(ctx context.Context, channel types.Channel) error
- func Ping() error
- func UpsertChannel(ctx context.Context, channel types.Channel) error
Constants ¶
View Source
const ( Insert = "INSERT" Update = "UPDATE" Delete = "DELETE" )
Operations the API performs on the database, to be sent as OP header through NATS
Variables ¶
View Source
var ( // ErrChannelAlreadyExists is returned when trying to add a channel that already exists in the database ErrChannelAlreadyExists = errors.New("channel already exists") // ErrChannelNotFound is returned when the channel you're trying to perform an operation on doesn't exist ErrChannelNotFound = errors.New("channel not found") )
Functions ¶
func DeleteChannel ¶
DeleteChannel deletes a channel by ID, returns an error if the channel ID was not found
func EnsureCollection ¶
func EnsureCollection(coll string)
func GetChannel ¶
GetChannel finds a single channel based on the BSON filter provided
func GetChannels ¶
GetChannels gets all channels, and runs the given callback in batches, where channels with the highest weight get the highest priority
func InsertChannel ¶
InsertChannel inserts a channel, returns error if it already exists
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.