Wip problem

This commit is contained in:
Magnus Åhall 2024-04-30 20:10:05 +02:00
parent 965e2daeb3
commit ffe0c3def2
3 changed files with 61 additions and 22 deletions

View file

@ -53,13 +53,13 @@ func (dp DatapointValue) Value() any { // {{{
return nil
} // }}}
func (dp DatapointValue) FormattedTime() string {
func (dp DatapointValue) FormattedTime() string {// {{{
if dp.ValueDateTime.Valid {
return dp.ValueDateTime.Time.Format("2006-01-02 15:04:05")
}
return "invalid time"
}
func (dp Datapoint) Update() (err error) {
}// }}}
func (dp Datapoint) Update() (err error) {// {{{
name := strings.TrimSpace(dp.Name)
if name == "" {
err = errors.New("Name can't be empty")
@ -82,7 +82,7 @@ func (dp Datapoint) Update() (err error) {
}
return
}
}// }}}
func DatapointAdd[T any](name string, value T) (err error) { // {{{
row := service.Db.Conn.QueryRow(`SELECT id, datatype FROM datapoint WHERE name=$1`, name)