connectionlog

package
v0.0.15 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const SqlAnyDeviceSubscription = `SELECT DISTINCT Device FROM ClientDeviceSubscription WHERE Device = any($1) AND Inactive = FALSE LIMIT $2`
View Source
const SqlCheckDeviceSubscriptionExists = `SELECT COUNT(1) FROM ClientDeviceSubscription WHERE Device = $1 AND Inactive = FALSE LIMIT 1;`
View Source
const SqlCleanSessionUpsert = `INSERT INTO CleanSession(Client, CleanSession) VALUES ($1, $2) ON CONFLICT (Client) DO UPDATE SET CleanSession = $2;`
View Source
const SqlCreateCleanSessionTable = `CREATE TABLE IF NOT EXISTS CleanSession (
	Client		VARCHAR(255) NOT NULL,
	CleanSession BOOLEAN,
	PRIMARY KEY (Client)
);`
View Source
const SqlCreateSubscriptionTable = `` /* 373-byte string literal not displayed */
View Source
const SqlDeleteClient = `DELETE FROM ClientDeviceSubscription WHERE Client = $1;`
View Source
const SqlDeleteSubscription = `DELETE FROM ClientDeviceSubscription WHERE Client = $1 AND Topic = $2;`
View Source
const SqlQueryCleanSession = `SELECT CleanSession FROM CleanSession WHERE Client = $1 LIMIT 1;`
View Source
const SqlSelectDeviceByClient = `SELECT DISTINCT Device FROM ClientDeviceSubscription WHERE Client = $1;`
View Source
const SqlSetClientInactive = `UPDATE ClientDeviceSubscription SET Inactive = $2 WHERE Client = $1;`
View Source
const SqlStoreSubscription = `INSERT INTO ClientDeviceSubscription(Client, Topic, Device) VALUES ($1, $2, $3) ON CONFLICT DO NOTHING;`

Variables

View Source
var Timeout = 1 * time.Second
View Source
var Void = &VoidType{}

Functions

This section is empty.

Types

type ConnectionLog

type ConnectionLog interface {
	Connect(client string)
	Disconnect(client string)
	Subscribe(client string, topic string, deviceId string)
	Unsubscribe(client string, topic string, deviceId string)
	SetCleanSession(id string, session bool)
}

func New

func New(producer kafka.ProducerInterface, conStr string, deviceLogTopic string) (result ConnectionLog, err error)

type ConnectionLogImpl

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

func (*ConnectionLogImpl) Connect

func (this *ConnectionLogImpl) Connect(client string)

func (*ConnectionLogImpl) Disconnect

func (this *ConnectionLogImpl) Disconnect(client string)

func (*ConnectionLogImpl) SetCleanSession

func (this *ConnectionLogImpl) SetCleanSession(client string, clean bool)

func (*ConnectionLogImpl) Subscribe

func (this *ConnectionLogImpl) Subscribe(client string, topic string, deviceId string)

func (*ConnectionLogImpl) Unsubscribe

func (this *ConnectionLogImpl) Unsubscribe(client string, topic string, deviceId string)

type VoidType

type VoidType struct{}

func (*VoidType) Connect

func (this *VoidType) Connect(client string)

func (*VoidType) Disconnect

func (this *VoidType) Disconnect(client string)

func (*VoidType) SetCleanSession

func (this *VoidType) SetCleanSession(id string, session bool)

func (*VoidType) Subscribe

func (this *VoidType) Subscribe(client string, topic string, deviceId string)

func (*VoidType) Unsubscribe

func (this *VoidType) Unsubscribe(client string, topic string, deviceId string)

Jump to

Keyboard shortcuts

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