util

package
v0.0.0-...-623860c Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2022 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Compress

func Compress(src string, dest string) error

func DeCompress

func DeCompress(tarFile, dest string) error

func PaginateIndex

func PaginateIndex(page, size, length int) (int, int)

func PrintFlags

func PrintFlags(flags *pflag.FlagSet)

PrintFlags logs the flags in the flagset

func PublishDeviceEvent

func PublishDeviceEvent(conn *amqp.Connection, exchange, exchangeType string,
	routingKey RabbitMQRoutingKey, event RabbitMQEvent, body interface{}, reliable bool) error

PublishDeviceEvent publishes relevant topic events to RabbitMQ.

func RandAllStringRunes

func RandAllStringRunes(n int) string

func RandNumberRunes

func RandNumberRunes(n int) string

func RandStringRunes

func RandStringRunes(n int) string

func ScpDir

func ScpDir(client *sftp.Client, srcDir, dstDir string, forward bool) error

func ScpFile

func ScpFile(client *sftp.Client, srcPath, dstPath string, forward bool) error

func SetupSigusr1Trap

func SetupSigusr1Trap()

func Str2Bool

func Str2Bool(s string) bool

func UpdateLogLevel

func UpdateLogLevel(w http.ResponseWriter, r *http.Request)

func ValidatePage

func ValidatePage(page, size string) (int, int, error)

Types

type ComponentMode

type ComponentMode string
const (
	ComponentModeCloud ComponentMode = "cloud"
	ComponentModeEdge  ComponentMode = "edge"
)

type RabbitMQBody

type RabbitMQBody struct {
	MsgId     string             `json:"msgId,omitempty"`
	MsgTopic  RabbitMQRoutingKey `json:"msgTopic,omitempty"`
	MsgEvent  RabbitMQEvent      `json:"msgEvent,omitempty"`
	Timestamp string             `json:"timestamp,omitempty"`
	Body      []byte             `json:"body,omitempty"`
}

type RabbitMQEvent

type RabbitMQEvent string
const (
	RabbitMQEventAdd    RabbitMQEvent = "add"
	RabbitMQEventUpdate RabbitMQEvent = "update"
	RabbitMQEventDelete RabbitMQEvent = "delete"
	RabbitMQEventImport RabbitMQEvent = "import"
)

type RabbitMQRoutingKey

type RabbitMQRoutingKey string
const (
	RabbitMQRoutingKeyDeviceModel        RabbitMQRoutingKey = "device-model"
	RabbitMQRoutingKeyDeviceModelFeature RabbitMQRoutingKey = "device-model-feature"
	RabbitMQRoutingKeyDevice             RabbitMQRoutingKey = "device"
	RabbitMQRoutingKeyDeviceProperty     RabbitMQRoutingKey = "device-property"
	RabbitMQRoutingKeyDeviceCommand      RabbitMQRoutingKey = "device-command"
	RabbitMQRoutingKeyDeviceSubDevice    RabbitMQRoutingKey = "device-subdevice"
)

Jump to

Keyboard shortcuts

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