Files
influx-cli/api/model_write_precision.gen.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

86 lines
1.8 KiB
Go

/*
* Subset of Influx API covered by Influx CLI
*
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* API version: 2.0.0
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package api
import (
"encoding/json"
"fmt"
)
// WritePrecision the model 'WritePrecision'
type WritePrecision string
// List of WritePrecision
const (
WRITEPRECISION_MS WritePrecision = "ms"
WRITEPRECISION_S WritePrecision = "s"
WRITEPRECISION_US WritePrecision = "us"
WRITEPRECISION_NS WritePrecision = "ns"
)
func (v *WritePrecision) UnmarshalJSON(src []byte) error {
var value string
err := json.Unmarshal(src, &value)
if err != nil {
return err
}
enumTypeValue := WritePrecision(value)
for _, existing := range []WritePrecision{"ms", "s", "us", "ns"} {
if existing == enumTypeValue {
*v = enumTypeValue
return nil
}
}
return fmt.Errorf("%+v is not a valid WritePrecision", value)
}
// Ptr returns reference to WritePrecision value
func (v WritePrecision) Ptr() *WritePrecision {
return &v
}
type NullableWritePrecision struct {
value *WritePrecision
isSet bool
}
func (v NullableWritePrecision) Get() *WritePrecision {
return v.value
}
func (v *NullableWritePrecision) Set(val *WritePrecision) {
v.value = val
v.isSet = true
}
func (v NullableWritePrecision) IsSet() bool {
return v.isSet
}
func (v *NullableWritePrecision) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableWritePrecision(val *WritePrecision) *NullableWritePrecision {
return &NullableWritePrecision{value: val, isSet: true}
}
func (v NullableWritePrecision) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableWritePrecision) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}