influx-cli/api/write_precision.go
Sam Arnold 9747d05ae1
refactor: expose generated code and client business logic to share with Kapacitor (#103)
* refactor: take clients out of internal

* refactor: move stdio to pkg

* Move internal/api to api

* refactor: final changes for Kapacitor to access shared functionality

* chore: regenerate mocks

* fix: bad automated refactor

* chore: extra formatting not caught by make fmt
2021-05-25 10:05:01 -04:00

26 lines
379 B
Go

package api
import (
"fmt"
)
func (v WritePrecision) String() string {
return string(v)
}
func (v *WritePrecision) Set(s string) error {
switch s {
case "ms":
*v = WRITEPRECISION_MS
case "s":
*v = WRITEPRECISION_S
case "us":
*v = WRITEPRECISION_US
case "ns":
*v = WRITEPRECISION_NS
default:
return fmt.Errorf("unsupported precision: %q", s)
}
return nil
}