CREATE TYPE IF NOT EXISTS ks.processing (
unit text,
scaling text,
k double,
m double,
min double,
max double,
condition text,
scalefunc text
);
which is used in table defined as
type Processing struct {
Unit string `json:"unit"`
Scaling Scaling `json:"scaling"`
K float64 `json:"k"`
M float64 `json:"m"`
Min float64 `json:"min"`
Max float64 `json:"max"`
Condition string `json:"condition"`
ScaleFunc string `json:"scalefunc"`
}
And for a given stored field, such as
{unit: '˚C', scaling: 'lin', k:1.1, m: 10, min: 15, max: 30, condition: null, scalefunc: null}
I read that with GoCQL, using Scanner (irrelevant parts not provided);
const datapointQuery = "SELECT project,subsystem,name,pollinterval,datasourcetype,timetolive,proc,ttnv3,web,mqtt FROM %s.%s WHERE orgid = ? AND project = ? AND subsystem = ? AND name = ? AND DELETED = '1970-01-01 0:00:00+0000' ALLOW FILTERING;"
func (cass *CassandraClient) GetDatapoint(org int64, projectName string, subsystemName string, datapoint string) (model.DatapointSettings, error) {
iter := cass.createQuery(datapointsTablename, datapointQuery, org, projectName, subsystemName, datapoint)
scanner := iter.Scanner()
for scanner.Next() {
return cass.deserializeDatapointRow(scanner), iter.Close()
}
return model.DatapointSettings{}, iter.Close()
}
func (cass *CassandraClient) createQuery(tableName string, query string, args ...interface{}) *gocql.Iter {
t := fmt.Sprintf(query, cass.clusterConfig.Keyspace, tableName)
q := cass.session.Query(t).Consistency(gocql.One).Idempotent(true).Bind(args...)
return q.Iter()
}
So, the problem I am seeing is that "k" and "m" is deserialized to the "Processing" instance, but "min" and "max" becomes "0". And I am running out of ideas of what could possibly be wrong. From my PoV, I can't see any difference between "k" and "m" vs "min" and "max", yet I observe very different behavior.