Bluemage/go/converter/converter.go
2024-08-05 23:06:32 +07:00

32 lines
809 B
Go

package converter
import (
"github.com/tigorlazuardi/bluemage/go/gen/models"
device "github.com/tigorlazuardi/bluemage/go/gen/proto/device/v1"
)
// goverter:converter
// goverter:extend BoolToInt8
// goverter:extend Int8ToBool
type DeviceConverter interface {
// goverter:ignore CreatedAt UpdatedAt
// goverter:map Nsfw NSFW
CreateDeviceRequestToModelsDevice(*device.CreateDeviceRequest) *models.Device
// goverter:ignore state sizeCache unknownFields
ModelsDeviceToCreateDeviceResponse(*models.Device) *device.CreateDeviceResponse
// goverter:ignore state sizeCache unknownFields
// goverter:map NSFW Nsfw
ModelsDeviceToGetDeviceResponse(*models.Device) *device.GetDeviceResponse
}
func BoolToInt8(b bool) int8 {
if b {
return 1
}
return 0
}
func Int8ToBool(i int8) bool {
return i > 0
}