Versions in this module Expand all Collapse all v1 v1.4.3 Sep 11, 2022 v1.4.2 Sep 11, 2022 Changes in this version + const DtLayout + const DtLayoutDay + const DtLayoutHour + const DtLayoutMinute + const DtLayoutMonth + const DtLayoutSecond + const DtLayoutYear + const DtLayoutZeroSeconds + const NullEndPoint + const PointTypeBoot + const PointTypeDaily + const PointTypeInstant + const PointTypeMonthly + const PointTypeTotal + const PointTypeYearly + const VirtualPsId + var Points = PointsMap + 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 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 + type Api struct + type Area interface + Call func(name EndPointName) output.Json + GetAreaName func() AreaName + GetData func(name EndPointName) output.Json + GetEndPoints func() TypeEndPoints + GetError func(name EndPointName) error + GetRequest func(name EndPointName) output.Json + GetResponse func(name EndPointName) output.Json + Init func(*Web) AreaStruct + IsValid func(name EndPointName) error + SetRequest func(name EndPointName, ref interface{}) error + type AreaName string + func GetArea(v interface{}) AreaName + type AreaNames []AreaName + type AreaStruct struct + ApiRoot interface{} + EndPoints TypeEndPoints + Error error + Name AreaName + func (as *AreaStruct) GetEndPoint(name EndPointName) EndPoint + func (as *AreaStruct) SortEndPoints() []EndPointName + func (as AreaStruct) CountDisabled() int + func (as AreaStruct) CountEnabled() int + func (as AreaStruct) Exists(name EndPointName) error + func (as AreaStruct) ListEndpoints() + type Areas map[AreaName]AreaStruct + 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) NotExists(area string) bool + func (an *Areas) SetRequest(area AreaName, name EndPointName, ref interface{}) error + func (an *Areas) SortAreas() AreaNames + func (an Areas) ListAreas() + func (an Areas) ListEndpoints(area string) error + type DataEntry struct + Date DateTime + EndPoint string + Index int + Point *Point + Value string + ValueFloat float64 + 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 struct + Entries map[string]DataEntry + Order []string + func NewDataMap() 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 struct + DateType string + Error error + func NewDateTime(date string) DateTime + func (dt *DateTime) GetDayEndTimestamp() string + func (dt *DateTime) GetDayStartTimestamp() string + func (dt DateTime) PrintFull() string + func (dt DateTime) String() string + type EndPoint interface + CacheFilename func() string + Call func() EndPoint + GetArea func() AreaName + GetCacheTimeout func() time.Duration + GetError func() error + GetJsonData func(bool) output.Json + GetName func() EndPointName + GetRequestJson func() output.Json + GetResponseJson func() output.Json + GetUrl func() EndPointUrl + Help func() string + IsDisabled func() bool + IsError func() bool + IsRequestValid func() error + IsResponseValid func() error + MarshalJSON func() ([]byte, error) + ReadDataFile func() error + RequestFingerprint func() string + RequestRef func() interface{} + RequestString func() string + ResponseRef func() interface{} + ResponseString func() string + SetCacheTimeout func(duration time.Duration) EndPoint + SetError func(string, ...interface{}) EndPoint + SetRequest func(ref interface{}) EndPoint + SetRequestByJson func(j output.Json) EndPoint + SetResponse func([]byte) EndPoint + String func() string + WriteDataFile func() error + type EndPointName string + func GetName(v interface{}) EndPointName + type EndPointStruct struct + ApiRoot Web + Area AreaName + Error error + FileNamePrefix string + Name EndPointName + RawResponse []byte + Request interface{} + Response interface{} + Url EndPointUrl + 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) SetFilenamePrefix(format string, args ...interface{}) string + func (ep *EndPointStruct) SetRequest(ref interface{}) error + func (ep EndPointStruct) ResponseAsJson(raw bool, r interface{}) output.Json + func (ep EndPointStruct) String() string + type EndPointUrl struct + EndPoint *url.URL + Error error + func SetUrl(endpoint string) EndPointUrl + func (u *EndPointUrl) IsValid() error + func (u *EndPointUrl) MarshalJSON() ([]byte, error) + func (u *EndPointUrl) UnmarshalJSON(data []byte) error + func (u EndPointUrl) AppendPath(endpoint string) EndPointUrl + func (u EndPointUrl) String() string + type Point struct + EndPoint string + FullId string + GroupName string + Id string + Name string + PsKey string + Type string + Unit string + Valid bool + func CreatePoint(psId string, point string, name string, unit string) *Point + func GetDevicePoint(devicePoint string) *Point + func GetPoint(device string, point string) *Point + func GetPointInt(device string, point int64) *Point + func ResolvePoint(point string) *Point + func (p *Point) WhenReset() string + func (p Point) IsDaily() bool + func (p Point) IsInstant() bool + func (p Point) IsMonthly() bool + func (p Point) IsTotal() bool + func (p Point) IsYearly() bool + func (p Point) String() string + type PointsMap map[string]Point + func (pm *PointsMap) Resolve(point string) *Point + func (pm PointsMap) Get(device string, point string) *Point + func (pm PointsMap) GetDevicePoint(devicePoint string) *Point + type Request struct + type RequestCommon struct + Appkey string + Lang string + SysCode string + Token string + UserID string + ValidFlag string + func (req RequestCommon) IsValid() error + func (req RequestCommon) String() string + type Response struct + type ResponseCommon struct + ReqSerialNum string + ResultCode string + ResultData []interface{} + ResultMsg string + func (req ResponseCommon) CheckResultCode() error + func (req ResponseCommon) CheckResultMessage() error + func (req ResponseCommon) IsTokenInvalid() bool + func (req ResponseCommon) IsTokenValid() bool + func (req ResponseCommon) IsValid() error + func (req ResponseCommon) String() string + type TemplatePoint struct + Description string + PointId string + PsKey string + Unit string + type TemplatePoints []TemplatePoint + func CreatePoints(points []string) TemplatePoints + func (t *TemplatePoints) GetPoint(pskey string, point string) TemplatePoint + func (t *TemplatePoints) PrintKeys() string + func (t *TemplatePoints) PrintPoints() string + type TypeEndPoints map[EndPointName]EndPoint + 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) Exists(name EndPointName) error + func (ps TypeEndPoints) String() string + type UnitValue struct + Unit string + Value string + ValueFloat float64 + ValueInt int64 + func CreateUnitValue(value string, unit string) UnitValue + func JsonToUnitValue(j string) UnitValue + func (ref *UnitValue) UnitValueFix() UnitValue + func (ref *UnitValue) UnitValueToPoint(psId string, point string, name string) *Point + type UnitValueMap map[string]UnitValue + func GetStructKeys(ref interface{}, keys ...string) UnitValueMap + func (u *UnitValueMap) Sort() []string + type UnitValues []UnitValue + type Web struct + Body []byte + Error error + Url EndPointUrl + 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