common

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2021 License: GPL-3.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Alphanum ...
	Alphanum = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
	// Alpha ...
	Alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
	// Number ...
	Number = "0123456789"
)
View Source
const (
	// JsonEngine ...
	JsonEngine = CopyEngine("json")
	// GobEngine ...
	GobEngine = CopyEngine("gob")
	// GojayEngine ...
	GojayEngine = CopyEngine("gojay")
)
View Source
const (
	// ScriptLangTs ...
	ScriptLangTs = ScriptLang("ts")
	// ScriptLangCoffee ...
	ScriptLangCoffee = ScriptLang("coffeescript")
	// ScriptLangJavascript ...
	ScriptLangJavascript = ScriptLang("javascript")
)
View Source
const (
	// Enabled ...
	Enabled = StatusType("enabled")
	// Disabled ...
	Disabled = StatusType("disabled")
	// Frozen ...
	Frozen = StatusType("frozen")
)
View Source
const (
	// MapElementPrototypeText ...
	MapElementPrototypeText = MapElementPrototypeType("text")
	// MapElementPrototypeImage ...
	MapElementPrototypeImage = MapElementPrototypeType("image")
	// MapElementPrototypeEntity ...
	MapElementPrototypeEntity = MapElementPrototypeType("entity")
	// MapElementPrototypeEmpty ...
	MapElementPrototypeEmpty = MapElementPrototypeType("")
)
View Source
const (
	// LogLevelEmergency ...
	LogLevelEmergency = LogLevel("Emergency")
	// LogLevelAlert ...
	LogLevelAlert = LogLevel("Alert")
	// LogLevelCritical ...
	LogLevelCritical = LogLevel("Critical")
	// LogLevelError ...
	LogLevelError = LogLevel("Error")
	// LogLevelWarning ...
	LogLevelWarning = LogLevel("Warning")
	// LogLevelNotice ...
	LogLevelNotice = LogLevel("Notice")
	// LogLevelInfo ...
	LogLevelInfo = LogLevel("Info")
	// LogLevelDebug ...
	LogLevelDebug = LogLevel("Debug")
)
View Source
const (
	// EntityHistoryState ...
	EntityHistoryState = EntityHistoryType("state")
	// EntityHistoryOption ...
	EntityHistoryOption = EntityHistoryType("option")
)
View Source
const (
	// MetricTypeLine ...
	MetricTypeLine = MetricType("line")
	// MetricTypeBar ...
	MetricTypeBar = MetricType("bar")
	// MetricTypeDoughnut ...
	MetricTypeDoughnut = MetricType("doughnut")
	// MetricTypeRadar ...
	MetricTypeRadar = MetricType("radar")
	// MetricTypePie ...
	MetricTypePie = MetricType("pie")
	// MetricTypeHorizontalBar ...
	MetricTypeHorizontalBar = MetricType("horizontal bar")
)
View Source
const (
	// AttributeString ...
	AttributeString = AttributeType("string")
	// AttributeInt ...
	AttributeInt = AttributeType("int")
	// AttributeTime ...
	AttributeTime = AttributeType("time")
	// AttributeBool ...
	AttributeBool = AttributeType("bool")
	// AttributeFloat ...
	AttributeFloat = AttributeType("float")
	//DEPRECATED
	AttributeArray = AttributeType("array")
	// AttributeMap ...
	AttributeMap = AttributeType("map")
)
View Source
const (
	// ConditionOr ...
	ConditionOr = ConditionType("or")
	// ConditionAnd ...
	ConditionAnd = ConditionType("and")
)
View Source
const (
	// DebugMode ...
	DebugMode = RunMode("debug")
	// ReleaseMode ...
	ReleaseMode = RunMode("release")
)
View Source
const DefaultPageSize int64 = 15

DefaultPageSize ...

Variables

View Source
var (

	// ErrInternal ...
	ErrInternal = errors.New("internal error")
	// ErrNotFound ...
	ErrNotFound = errors.New("not found")

	// ErrPassNotValid ...
	ErrPassNotValid = errors.New("password not valid")
	// ErrAccountIsBlocked ...
	ErrAccountIsBlocked = errors.New("account is blocked")
	// ErrNotAuthorized ...
	ErrNotAuthorized = errors.New("not authorized")

	// ErrMqttServerNoWorked ...
	ErrMqttServerNoWorked = errors.New("mqtt server not worked")
)

Functions

func CheckPasswordHash

func CheckPasswordHash(password, hash string) bool

CheckPasswordHash ...

func ComputeHmac256

func ComputeHmac256() string

ComputeHmac256 ...

func Copy

func Copy(to, from interface{}, params ...CopyEngine) (err error)

Copy ...

func CopyFile

func CopyFile(f, t string)

CopyFile ...

func Dir added in v0.5.0

func Dir() string

Dir ...

func FileExist

func FileExist(path string) (exist bool)

FileExist ...

func FormatSourceCode added in v0.5.0

func FormatSourceCode(filename string)

FormatSourceCode ...

func GetFileSize

func GetFileSize(name string) (int64, error)

GetFileSize ...

func GetFullPath

func GetFullPath(name string) string

GetFullPath ...

func GetLinkPath

func GetLinkPath(name string) string

GetLinkPath ...

func HashPassword

func HashPassword(password string) (string, error)

HashPassword ...

func Int added in v0.0.17

func Int(v int) *int

Int ...

func Int64 added in v0.0.17

func Int64(v int64) *int64

Int64 ...

func Int64Value added in v0.0.17

func Int64Value(v *int64) int64

Int64Value ...

func IntValue added in v0.0.17

func IntValue(v *int) int

IntValue ...

func ParseHmacToken

func ParseHmacToken(tokenString string, key []byte) (jwt.MapClaims, error)

ParseHmacToken ...

func RandInt

func RandInt(min int, max int) int

RandInt ...

func RandStr

func RandStr(strSize int, dictionary string) string

RandStr ...

func RandomString

func RandomString(l int) string

RandomString ...

func Rounding added in v0.5.0

func Rounding(num float64, k uint) float64

Rounding ...

func Start added in v0.5.0

func Start(app *fx.App)

Start ...

func StaticPath added in v0.1.0

func StaticPath() string

StaticPath ...

func Stop added in v0.5.0

func Stop(app *fx.App)

Stop ...

func StoragePath

func StoragePath() string

StoragePath ...

func String added in v0.0.17

func String(v string) *string

String ...

func StringValue added in v0.0.17

func StringValue(v *string) string

StringValue ...

func Strtomd5

func Strtomd5(s string) string

create md5 string

func TestMode added in v0.5.0

func TestMode() bool

TestMode ...

func Time added in v0.5.0

func Time(v time.Time) *time.Time

Time ...

func TimeValue added in v0.5.0

func TimeValue(v *time.Time) time.Time

TimeValue ...

func Work added in v0.5.0

func Work()

Work ...

Types

type AttributeType added in v0.5.0

type AttributeType string

AttributeType ...

type ConditionType added in v0.5.0

type ConditionType string

ConditionType ...

type CopyEngine

type CopyEngine string

CopyEngine ...

type EntityHistoryType added in v0.5.0

type EntityHistoryType string

EntityHistoryType ...

type EntityId added in v0.5.0

type EntityId string

EntityId ...

func NewEntityId added in v0.5.0

func NewEntityId(s string) *EntityId

NewEntityId ...

func (EntityId) Name added in v0.5.0

func (e EntityId) Name() string

Name ...

func (*EntityId) String added in v0.5.0

func (e *EntityId) String() string

String ...

func (EntityId) Type added in v0.5.0

func (e EntityId) Type() EntityType

Type ...

type EntityType added in v0.5.0

type EntityType string

EntityType ...

func (EntityType) String added in v0.5.0

func (e EntityType) String() string

String ...

type GinEngine added in v0.0.11

type GinEngine interface {
	GetEngine() *gin.Engine
}

GinEngine ...

type Icon added in v0.5.0

type Icon string

Icon ...

func NewIcon added in v0.5.0

func NewIcon(v string) *Icon

NewIcon ...

func (*Icon) String added in v0.5.0

func (i *Icon) String() string

String ...

type LogLevel

type LogLevel string

LogLevel ...

type Logger added in v0.1.3

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

Logger ...

func MustGetLogger added in v0.1.3

func MustGetLogger(p string) *Logger

MustGetLogger ...

func (*Logger) Debug added in v0.1.3

func (l *Logger) Debug(format string, args ...interface{})

Debug ...

func (*Logger) Debugf added in v0.1.3

func (l *Logger) Debugf(format string, args ...interface{})

Debugf ...

func (*Logger) Error added in v0.1.3

func (l *Logger) Error(format string, args ...interface{})

Error ...

func (*Logger) Errorf added in v0.1.3

func (l *Logger) Errorf(format string, args ...interface{})

Errorf ...

func (*Logger) Fatal added in v0.1.3

func (l *Logger) Fatal(format string, args ...interface{})

Fatal ...

func (*Logger) Fatalf added in v0.1.3

func (l *Logger) Fatalf(format string, args ...interface{})

Fatalf ...

func (*Logger) Info added in v0.1.3

func (l *Logger) Info(format string, args ...interface{})

Info ...

func (*Logger) Infof added in v0.1.3

func (l *Logger) Infof(format string, args ...interface{})

Infof ...

func (*Logger) Warn added in v0.1.3

func (l *Logger) Warn(format string, args ...interface{})

Warn ...

func (*Logger) Warnf added in v0.1.3

func (l *Logger) Warnf(format string, args ...interface{})

Warnf ...

type MapElementPrototypeId added in v0.5.0

type MapElementPrototypeId interface{}

MapElementPrototypeId ...

type MapElementPrototypeType added in v0.5.0

type MapElementPrototypeType string

MapElementPrototypeType ...

type MetricType added in v0.5.0

type MetricType string

MetricType ...

type PageParams added in v0.5.1

type PageParams struct {
	Limit  int64  `json:"limit" validate:"required,gte=1,lte=1000"`
	Offset int64  `json:"offset" validate:"required,gte=0,lte=1000"`
	Order  string `json:"order" validate:"required,oneof=created_at"`
	SortBy string `json:"sort_by" validate:"required,oneof=desc asc"`
}

PageParams ...

type PluginInfo added in v0.5.0

type PluginInfo struct {
	Name    string `json:"name"`
	Version string `json:"version"`
	Enabled bool   `json:"enabled"`
	System  bool   `json:"system"`
}

PluginInfo ...

type PluginManager added in v0.5.0

type PluginManager interface {
	Start()
	Shutdown()
	GetPlugin(name string) (plugin interface{}, err error)
	EnablePlugin(string) error
	DisablePlugin(string) error
	PluginList() (list []PluginInfo, total int64, err error)
}

PluginManager ...

type RunMode added in v0.5.0

type RunMode string

RunMode ...

type ScriptLang

type ScriptLang string

ScriptLang ...

type StatusType

type StatusType string

StatusType ...

Directories

Path Synopsis
astronomics
Package uuid provides implementation of Universally Unique Identifier (UUID).
Package uuid provides implementation of Universally Unique Identifier (UUID).

Jump to

Keyboard shortcuts

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