Documentation
¶
Index ¶
- Constants
- Variables
- func AppendUrl(host string, endpoint string) *url.URL
- func CheckString(name string, rc string) error
- func CleanString(s string) string
- func DivideByThousand(num string) (string, error)
- func DivideByThousandIfRequired(value string, unit string) (string, string)
- func Float32ToString(num float64) string
- func Float64ToString(num float64) string
- func GetPercent(value float64, max float64) float64
- func GetUrl(u string) *url.URL
- func HelpDataType() string
- func IsActive(value float64) bool
- func JoinDevicePoint(device string, point string) string
- func JoinStrings(args ...string) string
- func JoinStringsForId(args ...string) string
- func MapRange32(xr RangeFloat32, yr RangeFloat32) func(float32) (float32, error)
- func MapRange64(xr RangeFloat64, yr RangeFloat64) func(float64) (float64, error)
- func MarshalJSON(endpoint EndPoint) ([]byte, error)
- func NameDevicePoint(device string, point string) string
- func NameDevicePointInt(device string, point int64) string
- func PointToName(s string) string
- func SetPoint(point string) string
- func TimeNowString() string
- func ToLogFunc(value any, precision int) string
- type Aliases
- type Api
- type Area
- type AreaName
- type AreaNames
- type AreaStruct
- type Areas
- func (an *Areas) EndpointExists(area AreaName, name EndPointName) error
- func (an *Areas) Exists(area string) bool
- func (an *Areas) GetArea(area AreaName) *Area
- func (an *Areas) GetEndPoint(area AreaName, name EndPointName) EndPoint
- func (an *Areas) GetRequest(area AreaName, endpoint EndPointName) output.Json
- func (an *Areas) GetResponse(area AreaName, endpoint EndPointName) output.Json
- func (an Areas) ListAreas()
- func (an Areas) ListEndpoints(area string) error
- func (an *Areas) NotExists(area string) bool
- func (an *Areas) SetRequest(area AreaName, name EndPointName, ref interface{}) error
- func (an *Areas) SortAreas() AreaNames
- type ConvertAlias
- type ConvertArray
- type ConvertAsset
- type ConvertBinary
- type ConvertBitMap
- type ConvertBlob
- type ConvertBlobData
- type ConvertBlobDataArray
- type ConvertBlobOrder
- type ConvertFloatMap
- type ConvertFunction
- type ConvertIncrement
- type ConvertIndex
- type ConvertInteger
- type ConvertMap
- type ConvertRange
- type ConvertString
- type ConvertStruct
- type DataEntry
- func CreateDataEntryActive(date DateTime, psId string, point string, name string, value float64) DataEntry
- func CreateDataEntryString(date DateTime, psId string, point string, name string, value string) DataEntry
- func CreateDataEntryUnitValue(date DateTime, psId string, point string, name string, value UnitValue) DataEntry
- func (de *DataEntry) CreateAlias(psId string, point string, name string) DataEntry
- func (de *DataEntry) CreateFloat(psId string, point string, name string, value float64) DataEntry
- func (de *DataEntry) CreateState(psId string, point string, name string) DataEntry
- func (de *DataEntry) UpdateMeta(date *DateTime, psId string, point string, name string)
- type DataMap
- func (dm *DataMap) Add(point string, de DataEntry)
- func (dm *DataMap) AddEntry(point Point, date DateTime, value string)
- func (dm *DataMap) AddEntryFromRef(refPoint Point, point Point, date DateTime, value string)
- func (dm *DataMap) AddFloat(psId string, point string, name string, date DateTime, value float64)
- func (dm *DataMap) AddInt(psId string, point string, name string, date DateTime, value int64)
- func (dm *DataMap) AddString(psId string, point string, name string, date DateTime, value string)
- func (dm *DataMap) AddUnitValue(endpoint string, psId string, point string, name string, date DateTime, ...)
- func (dm *DataMap) CopyEntry(entry string) *DataEntry
- func (dm *DataMap) CopyPoint(refname string, psId string, point string, name string, value float64)
- func (dm *DataMap) FromRefAddAlias(refname string, psId string, point string, name string)
- func (dm *DataMap) FromRefAddAlias2(refname string, psId string, point string, name string)
- func (dm *DataMap) FromRefAddFloat(refname string, psId string, point string, name string, value float64)
- func (dm *DataMap) FromRefAddState(refname string, psId string, point string, name string)
- func (dm *DataMap) GetEntry(entry string) DataEntry
- func (dm *DataMap) GetFloatValue(entry string) float64
- func (dm *DataMap) GetPercent(value string, max string) float64
- func (dm *DataMap) GetValue(refname string) float64
- func (dm *DataMap) LowerUpper(lower string, upper string) float64
- func (dm *DataMap) StructToPoints(endpoint string, ref interface{})
- type DateTime
- type EndPoint
- type EndPointName
- type EndPointStruct
- func (ep *EndPointStruct) ApiCacheFilename(request interface{}) string
- func (ep *EndPointStruct) ApiFingerprint(request interface{}) string
- func (ep *EndPointStruct) ApiReadDataFile(ref interface{}) error
- func (ep *EndPointStruct) ApiWriteDataFile(ref interface{}) error
- func (ep *EndPointStruct) Call() output.Json
- func (ep *EndPointStruct) FileExists(fn string) bool
- func (ep *EndPointStruct) GetArea() AreaName
- func (ep *EndPointStruct) GetCsvFilename() string
- func (ep *EndPointStruct) GetFilePath() string
- func (ep *EndPointStruct) GetImageFilename() string
- func (ep *EndPointStruct) GetJsonFilename() string
- func (ep *EndPointStruct) GetName() EndPointName
- func (ep *EndPointStruct) GetRequest() output.Json
- func (ep *EndPointStruct) GetResponse() output.Json
- func (ep *EndPointStruct) GetUrl() EndPointUrl
- func (ep *EndPointStruct) IsValid() error
- func (ep EndPointStruct) ResponseAsJson(raw bool, r interface{}) output.Json
- func (ep *EndPointStruct) SetFilenamePrefix(format string, args ...interface{}) string
- func (ep *EndPointStruct) SetRequest(ref interface{}) error
- func (ep EndPointStruct) String() string
- type EndPointUrl
- type Labels
- type Point
- func (p *Point) CorrectUnit(unit string) *Point
- func (p *Point) GetIndexOptions() []string
- func (p *Point) IsBinary() bool
- func (p *Point) IsBinaryMap() bool
- func (p Point) IsDaily() bool
- func (p *Point) IsIndex() bool
- func (p Point) IsInstant() bool
- func (p *Point) IsMomentary() bool
- func (p Point) IsMonthly() bool
- func (p *Point) IsSwitch() bool
- func (p Point) IsTotal() bool
- func (p Point) IsYearly() bool
- func (p Point) Json() string
- func (p Point) String() string
- func (p *Point) WhenReset() string
- type PointsArrayMap
- type PointsMap
- func (pm *PointsMap) Append(b PointsMap) *PointsMap
- func (pm PointsMap) Get(device string, point string) *Point
- func (pm PointsMap) GetDevicePoint(devicePoint string) *Point
- func (pm *PointsMap) Json() string
- func (pm *PointsMap) Resolve(point string) *Point
- func (pm *PointsMap) SortEndPoints() []string
- func (pm PointsMap) String() string
- type PointsMapFile
- type RangeFloat32
- type RangeFloat64
- type Refresh
- type RefreshPoint
- type RefreshPoints
- type RefreshPointsArray
- type Request
- type RequestCommon
- type Response
- type ResponseCommon
- type TemplatePoint
- type TemplatePoints
- type TypeEndPoints
- func (ps TypeEndPoints) Exists(name EndPointName) error
- func (ps *TypeEndPoints) GetDisabled() TypeEndPoints
- func (ps *TypeEndPoints) GetEnabled() TypeEndPoints
- func (ps *TypeEndPoints) GetEndPoint(name EndPointName) EndPoint
- func (ps *TypeEndPoints) SortEndPoints() []EndPointName
- func (ps TypeEndPoints) String() string
- type UnitValue
- type UnitValueMap
- func (u *UnitValueMap) Add(key string, value any, unit string)
- func (u *UnitValueMap) Add2(key string, value string)
- func (u *UnitValueMap) Append(values UnitValueMap)
- func (u *UnitValueMap) GetFirst() *UnitValue
- func (u *UnitValueMap) GetFirstValue() string
- func (u *UnitValueMap) GetValueBool() bool
- func (u *UnitValueMap) GetValueFloat() float64
- func (u *UnitValueMap) GetValueInt() int64
- func (u *UnitValueMap) Sort() []string
- func (u UnitValueMap) String() string
- type UnitValues
- type Web
- func (w *Web) AppendUrl(endpoint string) EndPointUrl
- func (w *Web) CacheRead(endpoint EndPoint) ([]byte, error)
- func (w *Web) CacheRemove(endpoint EndPoint) error
- func (w *Web) CacheWrite(endpoint EndPoint, data []byte) error
- func (w *Web) CheckCache(endpoint EndPoint) bool
- func (w *Web) Get(endpoint EndPoint) EndPoint
- func (w *Web) GetCacheDir() string
- func (w *Web) GetCacheTimeout() time.Duration
- func (w *Web) SetCacheDir(basedir string) error
- func (w *Web) SetCacheTimeout(duration time.Duration)
- func (w *Web) SetUrl(u string) error
Constants ¶
View Source
const ( DtLayout = "2006-01-02 15:04:05" DtLayoutZeroSeconds = "2006-01-02 15:04:00" DtLayoutSecond = "20060102150405" DtLayoutMinute = "200601021504" DtLayoutHour = "2006010215" DtLayoutDay = "20060102" DtLayoutMonth = "200601" DtLayoutYear = "2006" )
View Source
const ( Off = "OFF" On = "ON" DefaultPrecision = 3 Single = "0" )
View Source
const ( PointTypeInstant = "instant" PointTypeBoot = "boot" PointTypeDaily = "daily" PointTypeMonthly = "monthly" PointTypeYearly = "yearly" PointTypeTotal = "total" )
View Source
const ( DefaultParentId = "virtual" TypeInstant = "instant" )
View Source
const DefaultBatchLimit = 200
View Source
const NullEndPoint = "nullEndPoint"
View Source
const (
VirtualPsId = "virtual"
)
Variables ¶
View Source
var Points = PointsMap{}/* 104 elements not displayed */
Points Discovered points from the API
Functions ¶
func CleanString ¶
func DivideByThousand ¶
func DivideByThousandIfRequired ¶
DivideByThousandIfRequired Sigh.... Another dodgy one.
func Float32ToString ¶
func Float64ToString ¶
func GetPercent ¶
func HelpDataType ¶
func HelpDataType() string
func JoinDevicePoint ¶
func JoinStrings ¶
func JoinStringsForId ¶
func MapRange32 ¶
func MapRange32(xr RangeFloat32, yr RangeFloat32) func(float32) (float32, error)
func MapRange64 ¶
func MapRange64(xr RangeFloat64, yr RangeFloat64) func(float64) (float64, error)
func MarshalJSON ¶
func NameDevicePoint ¶
func NameDevicePointInt ¶
func PointToName ¶
func TimeNowString ¶
func TimeNowString() string
Types ¶
type Aliases ¶
type Aliases map[ConvertAlias]ConvertStruct
func (*Aliases) Get ¶
func (a *Aliases) Get(selector *ConvertAlias) ConvertStruct
type Area ¶
type Area interface {
Init(*Web) AreaStruct
GetAreaName() AreaName
GetEndPoints() TypeEndPoints
Call(name EndPointName) output.Json
SetRequest(name EndPointName, ref interface{}) error
GetRequest(name EndPointName) output.Json
GetResponse(name EndPointName) output.Json
GetData(name EndPointName) output.Json
IsValid(name EndPointName) error
GetError(name EndPointName) error
}
type AreaStruct ¶
type AreaStruct struct {
ApiRoot interface{} // *web.Web
Name AreaName
EndPoints TypeEndPoints
Error error
}
func (AreaStruct) CountDisabled ¶
func (as AreaStruct) CountDisabled() int
func (AreaStruct) CountEnabled ¶
func (as AreaStruct) CountEnabled() int
func (AreaStruct) Exists ¶
func (as AreaStruct) Exists(name EndPointName) error
func (*AreaStruct) GetEndPoint ¶
func (as *AreaStruct) GetEndPoint(name EndPointName) EndPoint
func (AreaStruct) ListEndpoints ¶
func (as AreaStruct) ListEndpoints()
func (*AreaStruct) SortEndPoints ¶
func (as *AreaStruct) SortEndPoints() []EndPointName
type Areas ¶
type Areas map[AreaName]AreaStruct // TypeEndPoints // Map of EndPoints by area name.
func (*Areas) EndpointExists ¶
func (an *Areas) EndpointExists(area AreaName, name EndPointName) error
func (*Areas) GetEndPoint ¶
func (an *Areas) GetEndPoint(area AreaName, name EndPointName) EndPoint
func (*Areas) GetRequest ¶
func (an *Areas) GetRequest(area AreaName, endpoint EndPointName) output.Json
func (*Areas) GetResponse ¶
func (an *Areas) GetResponse(area AreaName, endpoint EndPointName) output.Json
func (Areas) ListEndpoints ¶
func (*Areas) SetRequest ¶
func (an *Areas) SetRequest(area AreaName, name EndPointName, ref interface{}) error
type ConvertAlias ¶
type ConvertAlias string
func (*ConvertAlias) Import ¶
func (c *ConvertAlias) Import() ConvertStruct
type ConvertArray ¶
func (*ConvertArray) Convert ¶
func (c *ConvertArray) Convert(index int, value any) UnitValueMap
func (*ConvertArray) Import ¶
func (c *ConvertArray) Import() error
func (*ConvertArray) Set ¶
func (c *ConvertArray) Set(value any) any
type ConvertAsset ¶
type ConvertAsset struct {
Url bool `json:"url"`
Icon bool `json:"icon"`
String bool `json:"string"`
}
func (*ConvertAsset) Convert ¶
func (c *ConvertAsset) Convert(value any) string
func (*ConvertAsset) Import ¶
func (c *ConvertAsset) Import() error
func (*ConvertAsset) Set ¶
func (c *ConvertAsset) Set(value any) any
type ConvertBinary ¶
type ConvertBinary struct {
On string `json:"on"`
Off string `json:"off"`
Type string `json:"type"`
IsSwitch bool `json:"-"`
IsMomentary bool `json:"-"`
IsInverted bool `json:"-"`
}
func (*ConvertBinary) Convert ¶
func (c *ConvertBinary) Convert(value any) string
func (*ConvertBinary) Import ¶
func (c *ConvertBinary) Import() error
func (*ConvertBinary) Set ¶
func (c *ConvertBinary) Set(value any) any
type ConvertBitMap ¶
type ConvertBitMap []string
func (*ConvertBitMap) GetOptions ¶
func (c *ConvertBitMap) GetOptions() []string
func (*ConvertBitMap) Import ¶
func (c *ConvertBitMap) Import() error
func (*ConvertBitMap) Set ¶
func (c *ConvertBitMap) Set(value any) any
type ConvertBlob ¶
type ConvertBlob struct {
Order []struct {
Data *ConvertBlobData `json:"data"`
Array *ConvertBlobDataArray `json:"array"`
} `json:"order"`
Sequence []ConvertBlobData `json:"-"`
}
func (*ConvertBlob) Convert ¶
func (c *ConvertBlob) Convert(value any) UnitValueMap
func (*ConvertBlob) Import ¶
func (c *ConvertBlob) Import(aliases Aliases) error
func (*ConvertBlob) Set ¶
func (c *ConvertBlob) Set(value any) any
type ConvertBlobData ¶
type ConvertBlobData struct {
Convert *ConvertStruct `json:"convert"`
Unit string `json:"unit"`
Key string `json:"key"`
Type string `json:"type"`
BigEndian bool `json:"big_endian"`
}
func (*ConvertBlobData) ReaderString ¶
func (c *ConvertBlobData) ReaderString(reader *bytes.Reader) string
func (*ConvertBlobData) ReaderValue ¶
func (c *ConvertBlobData) ReaderValue(reader *bytes.Reader) (string, error)
type ConvertBlobDataArray ¶
type ConvertBlobDataArray struct {
Data ConvertBlobData `json:"data"`
Count int `json:"count"`
Offset int `json:"offset"`
Keys []string `json:"keys"`
}
func (*ConvertBlobDataArray) ReaderStrings ¶
func (c *ConvertBlobDataArray) ReaderStrings(reader *bytes.Reader) []string
type ConvertBlobOrder ¶
type ConvertBlobOrder []struct {
Data *ConvertBlobData `json:"data"`
Array *ConvertBlobDataArray `json:"array"`
}
type ConvertFloatMap ¶
type ConvertFloatMap struct {
Values map[string]string `json:"values"`
Precision int `json:"precision"`
Map map[string]string `json:"-"`
DefaultZero string `json:"-"`
}
func (*ConvertFloatMap) Convert ¶
func (c *ConvertFloatMap) Convert(value any) string
func (*ConvertFloatMap) Import ¶
func (c *ConvertFloatMap) Import() error
func (*ConvertFloatMap) Set ¶
func (c *ConvertFloatMap) Set(value any) any
type ConvertFunction ¶
type ConvertFunction string
func (*ConvertFunction) Convert ¶
func (c *ConvertFunction) Convert(value any) string
func (*ConvertFunction) Import ¶
func (c *ConvertFunction) Import() error
func (*ConvertFunction) Set ¶
func (c *ConvertFunction) Set(value any) any
type ConvertIncrement ¶
type ConvertIncrement struct {
Min float64 `json:"min"`
Max float64 `json:"max"`
Increment float64 `json:"increment"`
Precision int `json:"precision"`
}
func (*ConvertIncrement) Convert ¶
func (c *ConvertIncrement) Convert(value any) string
func (*ConvertIncrement) Import ¶
func (c *ConvertIncrement) Import() error
func (*ConvertIncrement) Set ¶
func (c *ConvertIncrement) Set(value any) any
type ConvertIndex ¶
type ConvertIndex []string
func (*ConvertIndex) Convert ¶
func (c *ConvertIndex) Convert(value any) string
func (*ConvertIndex) GetOptions ¶
func (c *ConvertIndex) GetOptions() []string
func (*ConvertIndex) Import ¶
func (c *ConvertIndex) Import() error
func (*ConvertIndex) Set ¶
func (c *ConvertIndex) Set(value any) any
type ConvertInteger ¶
func (*ConvertInteger) Convert ¶
func (c *ConvertInteger) Convert(value any) string
func (*ConvertInteger) Import ¶
func (c *ConvertInteger) Import() error
func (*ConvertInteger) Set ¶
func (c *ConvertInteger) Set(value any) any
type ConvertMap ¶
func (*ConvertMap) Convert ¶
func (c *ConvertMap) Convert(value any) string
func (*ConvertMap) GetOptions ¶
func (c *ConvertMap) GetOptions() []string
func (*ConvertMap) Import ¶
func (c *ConvertMap) Import() error
func (*ConvertMap) Set ¶
func (c *ConvertMap) Set(value any) any
type ConvertRange ¶
type ConvertRange struct {
InMin float64 `json:"in_min"`
InMax float64 `json:"in_max"`
OutMin float64 `json:"out_min"`
OutMax float64 `json:"out_max"`
Precision int `json:"precision"`
}
func (*ConvertRange) Convert ¶
func (c *ConvertRange) Convert(value any) string
func (*ConvertRange) Import ¶
func (c *ConvertRange) Import() error
func (*ConvertRange) Set ¶
func (c *ConvertRange) Set(value any) any
type ConvertString ¶
type ConvertString struct {
Size int `json:"size"`
}
func (*ConvertString) Convert ¶
func (c *ConvertString) Convert(value any) string
func (*ConvertString) Import ¶
func (c *ConvertString) Import() error
func (*ConvertString) Set ¶
func (c *ConvertString) Set(value any) any
type ConvertStruct ¶
type ConvertStruct struct {
Alias *ConvertAlias `json:"alias,omitempty"`
Increment *ConvertIncrement `json:"increment,omitempty"`
Range *ConvertRange `json:"range,omitempty"`
Map *ConvertMap `json:"map,omitempty"`
BitMap *ConvertBitMap `json:"bit_map,omitempty"`
Function *ConvertFunction `json:"function,omitempty"`
Binary *ConvertBinary `json:"binary,omitempty"`
String *ConvertString `json:"string,omitempty"`
Asset *ConvertAsset `json:"asset,omitempty"`
Array *ConvertArray `json:"array,omitempty"`
FloatMap *ConvertFloatMap `json:"float_map,omitempty"`
Integer *ConvertInteger `json:"integer,omitempty"`
Blob *ConvertBlob `json:"blob,omitempty"`
Index *ConvertIndex `json:"index,omitempty"`
}
func (*ConvertStruct) GetConvertType ¶
func (c *ConvertStruct) GetConvertType() string
func (*ConvertStruct) GetValue ¶
func (c *ConvertStruct) GetValue(value any) string
func (*ConvertStruct) GetValues ¶
func (c *ConvertStruct) GetValues(values ...any) UnitValueMap
func (*ConvertStruct) SetValue ¶
func (c *ConvertStruct) SetValue(value any) any
type DataEntry ¶
type DataEntry struct {
EndPoint string `json:"endpoint"`
Point *Point `json:"point"`
Date DateTime `json:"date"`
// Id string `json:"id"`
// GroupName string `json:"group_name"`
// Name string `json:"name"`
// Unit string `json:"unit"`
Value string `json:"value"`
ValueFloat float64 `json:"value_float"`
Index int `json:"index"`
}
func CreateDataEntryActive ¶
func CreateDataEntryString ¶
func (*DataEntry) CreateAlias ¶
func (*DataEntry) CreateFloat ¶
func (*DataEntry) CreateState ¶
type DataMap ¶
func NewDataMap ¶
func NewDataMap() DataMap
func (*DataMap) AddEntryFromRef ¶
func (*DataMap) AddUnitValue ¶
func (*DataMap) FromRefAddAlias ¶
func (*DataMap) FromRefAddAlias2 ¶
func (*DataMap) FromRefAddFloat ¶
func (*DataMap) FromRefAddState ¶
func (*DataMap) GetFloatValue ¶
func (*DataMap) StructToPoints ¶
type DateTime ¶
type DateTime struct {
time.Time
DateType string
Error error
// contains filtered or unexported fields
}
func NewDateTime ¶
func (*DateTime) GetDayEndTimestamp ¶
func (*DateTime) GetDayStartTimestamp ¶
type EndPoint ¶
type EndPoint interface {
GetArea() AreaName
GetName() EndPointName
GetUrl() EndPointUrl
IsDisabled() bool
Help() string
Call() EndPoint
SetError(string, ...interface{}) EndPoint
GetError() error
IsError() bool
MarshalJSON() ([]byte, error)
ReadDataFile() error
WriteDataFile() error
String() string
GetJsonData(bool) output.Json
SetRequest(ref interface{}) EndPoint // EndPointStruct
SetRequestByJson(j output.Json) EndPoint
RequestRef() interface{}
GetRequestJson() output.Json
IsRequestValid() error
RequestString() string
RequestFingerprint() string
SetResponse([]byte) EndPoint // EndPointStruct
ResponseRef() interface{}
GetResponseJson() output.Json
IsResponseValid() error
ResponseString() string
// WriteCache() error
// ReadCache() EndPoint
// CheckCache() bool
CacheFilename() string
SetCacheTimeout(duration time.Duration) EndPoint
GetCacheTimeout() time.Duration
}
type EndPointName ¶
type EndPointName string
func GetName ¶
func GetName(v interface{}) EndPointName
type EndPointStruct ¶
type EndPointStruct struct {
ApiRoot Web `json:"-"`
RawResponse []byte
Area AreaName `json:"area"`
Name EndPointName `json:"name"`
Url EndPointUrl `json:"url"`
FileNamePrefix string
Request interface{} `json:"-"`
Response interface{} `json:"-"`
Error error `json:"-"`
}
func (*EndPointStruct) ApiCacheFilename ¶
func (ep *EndPointStruct) ApiCacheFilename(request interface{}) string
func (*EndPointStruct) ApiFingerprint ¶
func (ep *EndPointStruct) ApiFingerprint(request interface{}) string
func (*EndPointStruct) ApiReadDataFile ¶
func (ep *EndPointStruct) ApiReadDataFile(ref interface{}) error
FileRead Retrieves data from a local file.
func (*EndPointStruct) ApiWriteDataFile ¶
func (ep *EndPointStruct) ApiWriteDataFile(ref interface{}) error
FileWrite Saves data to a file path.
func (*EndPointStruct) Call ¶
func (ep *EndPointStruct) Call() output.Json
func (*EndPointStruct) FileExists ¶
func (ep *EndPointStruct) FileExists(fn string) bool
FileExists Checks for existance of a local file.
func (*EndPointStruct) GetArea ¶
func (ep *EndPointStruct) GetArea() AreaName
func (*EndPointStruct) GetCsvFilename ¶
func (ep *EndPointStruct) GetCsvFilename() string
func (*EndPointStruct) GetFilePath ¶
func (ep *EndPointStruct) GetFilePath() string
func (*EndPointStruct) GetImageFilename ¶
func (ep *EndPointStruct) GetImageFilename() string
func (*EndPointStruct) GetJsonFilename ¶
func (ep *EndPointStruct) GetJsonFilename() string
func (*EndPointStruct) GetName ¶
func (ep *EndPointStruct) GetName() EndPointName
func (*EndPointStruct) GetRequest ¶
func (ep *EndPointStruct) GetRequest() output.Json
func (*EndPointStruct) GetResponse ¶
func (ep *EndPointStruct) GetResponse() output.Json
func (*EndPointStruct) GetUrl ¶
func (ep *EndPointStruct) GetUrl() EndPointUrl
func (*EndPointStruct) IsValid ¶
func (ep *EndPointStruct) IsValid() error
func (EndPointStruct) ResponseAsJson ¶
func (ep EndPointStruct) ResponseAsJson(raw bool, r interface{}) output.Json
func (*EndPointStruct) SetFilenamePrefix ¶
func (ep *EndPointStruct) SetFilenamePrefix(format string, args ...interface{}) string
func (*EndPointStruct) SetRequest ¶
func (ep *EndPointStruct) SetRequest(ref interface{}) error
func (EndPointStruct) String ¶
func (ep EndPointStruct) String() string
type EndPointUrl ¶
func SetUrl ¶
func SetUrl(endpoint string) EndPointUrl
func (EndPointUrl) AppendPath ¶
func (u EndPointUrl) AppendPath(endpoint string) EndPointUrl
func (*EndPointUrl) IsValid ¶
func (u *EndPointUrl) IsValid() error
func (*EndPointUrl) MarshalJSON ¶
func (u *EndPointUrl) MarshalJSON() ([]byte, error)
func (EndPointUrl) String ¶
func (u EndPointUrl) String() string
func (*EndPointUrl) UnmarshalJSON ¶
func (u *EndPointUrl) UnmarshalJSON(data []byte) error
type Point ¶
type Point struct {
EndPoint string `json:"endpoint"`
FullId string `json:"full_id"`
ParentId string `json:"parent_id"`
Id string `json:"id"`
GroupName string `json:"group_name"`
Name string `json:"name"`
Unit string `json:"unit"`
Type string `json:"type"`
Valid bool `json:"valid"`
Info string `json:"info"`
Convert ConvertStruct `json:"convert"`
}
func GetDevicePoint ¶
func GetPointInt ¶
func ResolvePoint ¶
func (*Point) CorrectUnit ¶
func (*Point) GetIndexOptions ¶
func (*Point) IsBinaryMap ¶
func (*Point) IsMomentary ¶
type PointsArrayMap ¶
type PointsMapFile ¶
type PointsMapFile struct {
Refresh Refresh `json:"refresh"`
Aliases Aliases `json:"aliases"`
PointsMap PointsMap `json:"points"`
PointsArrayMap PointsArrayMap `json:"points_array_map"`
}
type RangeFloat32 ¶
type RangeFloat64 ¶
type Refresh ¶
type Refresh struct {
RefreshPointsArray RefreshPointsArray `json:"points_array_map"`
RefreshPoints RefreshPoints `json:"points"`
Delay *int `json:"delay"`
BatchLimit *int `json:"batch_limit"`
}
type RefreshPoint ¶
func (*RefreshPoint) IsExpired ¶
func (rp *RefreshPoint) IsExpired() bool
func (*RefreshPoint) Reset ¶
func (rp *RefreshPoint) Reset()
type RefreshPoints ¶
type RefreshPoints map[string]*RefreshPoint
func ImportRefresh ¶
func ImportRefresh(filenames ...string) (RefreshPoints, int, error)
type RefreshPointsArray ¶
type Request ¶
type Request struct {
RequestCommon
}
type RequestCommon ¶
type RequestCommon struct {
Appkey string `json:"appkey" required:"true"`
Lang string `json:"lang"`
SysCode string `json:"sys_code" required:"true"`
Token string `json:"token"`
UserID string `json:"user_id"`
ValidFlag string `json:"valid_flag"`
}
func (RequestCommon) IsValid ¶
func (req RequestCommon) IsValid() error
func (RequestCommon) String ¶
func (req RequestCommon) String() string
type Response ¶
type Response struct {
ResponseCommon
}
type ResponseCommon ¶
type ResponseCommon struct {
ReqSerialNum string `json:"req_serial_num"`
ResultCode string `json:"result_code"`
ResultData []interface{} `json:"result_data"`
ResultMsg string `json:"result_msg"`
}
func (ResponseCommon) CheckResultCode ¶
func (req ResponseCommon) CheckResultCode() error
func (ResponseCommon) CheckResultMessage ¶
func (req ResponseCommon) CheckResultMessage() error
func (ResponseCommon) IsTokenInvalid ¶
func (req ResponseCommon) IsTokenInvalid() bool
func (ResponseCommon) IsTokenValid ¶
func (req ResponseCommon) IsTokenValid() bool
func (ResponseCommon) IsValid ¶
func (req ResponseCommon) IsValid() error
func (ResponseCommon) String ¶
func (req ResponseCommon) String() string
type TemplatePoint ¶
type TemplatePoints ¶
type TemplatePoints []TemplatePoint
func CreatePoints ¶
func CreatePoints(points []string) TemplatePoints
func (*TemplatePoints) GetPoint ¶
func (t *TemplatePoints) GetPoint(pskey string, point string) TemplatePoint
func (*TemplatePoints) PrintKeys ¶
func (t *TemplatePoints) PrintKeys() string
func (*TemplatePoints) PrintPoints ¶
func (t *TemplatePoints) PrintPoints() string
type TypeEndPoints ¶
type TypeEndPoints map[EndPointName]EndPoint // Map of EndPoints by endpoint name.
func (TypeEndPoints) Exists ¶
func (ps TypeEndPoints) Exists(name EndPointName) error
func (*TypeEndPoints) GetDisabled ¶
func (ps *TypeEndPoints) GetDisabled() TypeEndPoints
func (*TypeEndPoints) GetEnabled ¶
func (ps *TypeEndPoints) GetEnabled() TypeEndPoints
func (*TypeEndPoints) GetEndPoint ¶
func (ps *TypeEndPoints) GetEndPoint(name EndPointName) EndPoint
func (*TypeEndPoints) SortEndPoints ¶
func (ps *TypeEndPoints) SortEndPoints() []EndPointName
func (TypeEndPoints) String ¶
func (ps TypeEndPoints) String() string
type UnitValue ¶
type UnitValue struct {
Unit string `json:"unit"`
Value any `json:"value"`
ValueString string `json:"value_string,omitempty"`
ValueFloat float64 `json:"value_float,omitempty"`
ValueInt int64 `json:"value_int,omitempty"`
ValueBool bool `json:"value_bool,omitempty"`
}
func CreateUnitValue ¶
func JsonToUnitValue ¶
func (*UnitValue) UnitValueFix ¶
type UnitValueMap ¶
func GetStructKeys ¶
func GetStructKeys(ref interface{}, keys ...string) UnitValueMap
func (*UnitValueMap) Add2 ¶
func (u *UnitValueMap) Add2(key string, value string)
func (*UnitValueMap) Append ¶
func (u *UnitValueMap) Append(values UnitValueMap)
func (*UnitValueMap) GetFirst ¶
func (u *UnitValueMap) GetFirst() *UnitValue
func (*UnitValueMap) GetFirstValue ¶
func (u *UnitValueMap) GetFirstValue() string
func (*UnitValueMap) GetValueBool ¶
func (u *UnitValueMap) GetValueBool() bool
func (*UnitValueMap) GetValueFloat ¶
func (u *UnitValueMap) GetValueFloat() float64
func (*UnitValueMap) GetValueInt ¶
func (u *UnitValueMap) GetValueInt() int64
func (*UnitValueMap) Sort ¶
func (u *UnitValueMap) Sort() []string
func (UnitValueMap) String ¶
func (u UnitValueMap) String() string
type UnitValues ¶
type UnitValues []UnitValue
type Web ¶
type Web struct {
Url EndPointUrl
Body []byte
Error error
// contains filtered or unexported fields
}
func (*Web) AppendUrl ¶
func (w *Web) AppendUrl(endpoint string) EndPointUrl
func (*Web) CacheRemove ¶
CacheRemove Removes a cache file.
func (*Web) CacheWrite ¶
CacheWrite Saves cache data to a file path.
func (*Web) CheckCache ¶
CheckCache Retrieves cache data from a local file.
func (*Web) GetCacheDir ¶
func (*Web) GetCacheTimeout ¶
func (*Web) SetCacheDir ¶
func (*Web) SetCacheTimeout ¶
Source Files
¶
- const.go
- datetime.go
- file.go
- funcs.go
- help.go
- interface_area.go
- interface_endpoint.go
- struct_area.go
- struct_areas.go
- struct_convert.go
- struct_data.go
- struct_endpoint.go
- struct_endpoints.go
- struct_import.go
- struct_point.go
- struct_points.go
- struct_request.go
- struct_response.go
- struct_template_points.go
- struct_url.go
- types.go
- utils.go
- web.go
Directories
¶
| Path | Synopsis |
|---|---|
|
Package apiReflect - Snaffooed from https://github.com/fatih/structs
|
Package apiReflect - Snaffooed from https://github.com/fatih/structs |
|
Package nullEndPoint - This file is auto-generated from the update_all.sh script.
|
Package nullEndPoint - This file is auto-generated from the update_all.sh script. |
Click to show internal directories.
Click to hide internal directories.