yats.git

ref: d5669fb6eab6ee1b6741def4f86f43bf024f0713

server/model/models.go


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
/**
 * Yats - yats
 *
 * This file is licensed under the Affero General Public License version 3 or
 * later. See the COPYING file.
 *
 * @author Paolo Lulli <kevwe.com>
 * @copyright Paolo Lulli 2024
 */

package model

type MetricModel struct {
	IdClient string `json:"id_client" parquet:"name=id_client, type=BYTE_ARRAY, convertedtype=UTF8"`
	Mtime    int64  `json:"mtime" parquet:"name=mtime, type=INT64, convertedtype=TIMESTAMP_MILLIS"`
	Name     string `json:"name" parquet:"name=name, type=BYTE_ARRAY, convertedtype=UTF8"`
	Value    string `json:"value" parquet:"name=value, type=BYTE_ARRAY, convertedtype=UTF8"`
}

type MetricRequest struct {
	Mtime int64  `json:"mtime" parquet:"name=mtime, type=INT64, convertedtype=TIMESTAMP_MILLIS"`
	Name  string `json:"name" parquet:"name=name, type=BYTE_ARRAY, convertedtype=UTF8"`
	Value string `json:"value" parquet:"name=value, type=BYTE_ARRAY, convertedtype=UTF8"`
}

type EventModel struct {
	IdClient string `json:"id_client" parquet:"name=id_client, type=BYTE_ARRAY, convertedtype=UTF8"`
	Etime    int64  `json:"etime" parquet:"name=etime, type=INT64, convertedtype=TIMESTAMP_MILLIS"`
	Name     string `json:"name" parquet:"name=name, type=BYTE_ARRAY, convertedtype=UTF8"`
}

type EventRequest struct {
	Etime int64  `json:"etime" parquet:"name=etime, type=INT64, convertedtype=TIMESTAMP_MILLIS"`
	Name  string `json:"name" parquet:"name=name, type=BYTE_ARRAY, convertedtype=UTF8"`
}

type PositionModel struct {
	IdClient string  `json:"id_client" parquet:"name=id_client, type=BYTE_ARRAY, convertedtype=UTF8"`
	Ptime    int64   `json:"ptime" parquet:"name=ptime, type=INT64, convertedtype=TIMESTAMP_MILLIS"`
	Lon      float64 `json:"lon" parquet:"name=lon, type=DOUBLE"` //TODO Check parquet types
	Lat      float64 `json:"lat" parquet:"name=lat, type=DOUBLE"` //TODO Check parquet types
	Name     string  `json:"name" parquet:"name=name, type=BYTE_ARRAY, convertedtype=UTF8"`
}

type PositionRequest struct {
	Ptime int64   `json:"ptime" parquet:"name=ptime, type=INT64, convertedtype=TIMESTAMP_MILLIS"`
	Lon   float64 `json:"lon" parquet:"name=lon, type=DOUBLE"` //TODO Check parquet types
	Lat   float64 `json:"lat" parquet:"name=lat, type=DOUBLE"` //TODO Check parquet types
	Name  string  `json:"name" parquet:"name=name, type=BYTE_ARRAY, convertedtype=UTF8"`
}

type ClientInfo struct {
	ID      string
	Created int64
	Name    string
}

type MetricInfo struct {
	IdClient    string
	Name        string
	Description string
}

type MetricSearchRequest struct {
	From              int64  `json:"from" parquet:"name=mtime, type=INT64, convertedtype=TIMESTAMP_MILLIS"`
	To                int64  `json:"to" parquet:"name=mtime, type=INT64, convertedtype=TIMESTAMP_MILLIS"`
	Name              string `json:"name" parquet:"name=name, type=BYTE_ARRAY, convertedtype=UTF8"`
	SourceApplication string `json:"source" parquet:"name=source_application, type=BYTE_ARRAY, convertedtype=UTF8"`
}

type EventSearchRequest struct {
	From              int64  `json:"from" parquet:"name=mtime, type=INT64, convertedtype=TIMESTAMP_MILLIS"`
	To                int64  `json:"to" parquet:"name=mtime, type=INT64, convertedtype=TIMESTAMP_MILLIS"`
	SourceApplication string `json:"source" parquet:"name=source_application, type=BYTE_ARRAY, convertedtype=UTF8"`
}

type PositionSearchRequest struct {
	From              int64  `json:"from" parquet:"name=mtime, type=INT64, convertedtype=TIMESTAMP_MILLIS"`
	To                int64  `json:"to" parquet:"name=mtime, type=INT64, convertedtype=TIMESTAMP_MILLIS"`
	SourceApplication string `json:"source" parquet:"name=source_application, type=BYTE_ARRAY, convertedtype=UTF8"`
}

type AvailableMetric struct {
	Name        string `json:"name"`
	Description string `json:"description"`
}

type ExternalSource struct {
	Name string `json:"name"`
	App  string `json:"app"`
	Type string `json:"type"`
}

type PermsResponse struct {
	Metrics []AvailableMetric `json:"metrics"`
	Sources []ExternalSource  `json:"sources"`
}