Skip to content

Commit

Permalink
vector marshaling + removes enumeration constants
Browse files Browse the repository at this point in the history
  • Loading branch information
GeremWD committed Jun 14, 2023
1 parent e154d85 commit 3521293
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 73 deletions.
34 changes: 13 additions & 21 deletions types/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,12 @@ import (
)

type Vector2 struct {
X float64 `json:"x"`
Y float64 `json:"y"`
X float64
Y float64
}

func (v Vector2) MarshalJSON() ([]byte, error) {
return json.Marshal([]float64{v.X, v.Y})
}

type Vector2Wrapper struct {
Expand All @@ -29,9 +33,13 @@ func (v *Vector2Wrapper) UnmarshalJSON(data []byte) error {
}

type Vector3 struct {
X float64 `json:"x"`
Y float64 `json:"y"`
Z float64 `json:"z"`
X float64
Y float64
Z float64
}

func (v Vector3) MarshalJSON() ([]byte, error) {
return json.Marshal([]float64{v.X, v.Y, v.Z})
}

type Vector3Wrapper struct {
Expand All @@ -52,24 +60,8 @@ func (v *Vector3Wrapper) UnmarshalJSON(data []byte) error {
}

type Color string

type MetricImperialUnit string

const (
MetricMM MetricImperialUnit = "mm"
MetricCM MetricImperialUnit = "cm"
MetricM MetricImperialUnit = "m"
MetricF MetricImperialUnit = "f"
)

type FloorMetric string

const (
FloorM FloorMetric = "m"
FloorT FloorMetric = "t"
FloorF FloorMetric = "f"
)

type Slug string

type Header struct {
Expand Down
5 changes: 0 additions & 5 deletions types/corridor.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@ import "encoding/json"

type Temperature string

const (
COLD Temperature = "cold"
WARM Temperature = "warm"
)

type Corridor struct {
Header
Content string `json:"content"`
Expand Down
7 changes: 0 additions & 7 deletions types/device.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,6 @@ import "encoding/json"

type DeviceOrientation string

const (
DeviceFront DeviceOrientation = "front"
DeviceRear DeviceOrientation = "rear"
DeviceFrontflipped DeviceOrientation = "frontflipped"
DeviceRearflipped DeviceOrientation = "rearflipped"
)

type DeviceTemplate = RackTemplate

type Device struct {
Expand Down
33 changes: 0 additions & 33 deletions types/rack.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,43 +6,10 @@ import (
)

type RackOrientation string

const (
RackFront RackOrientation = "front"
RackRear RackOrientation = "rear"
RackLeft RackOrientation = "left"
RackRight RackOrientation = "right"
)

type RackUnit string

const (
RackMM RackUnit = "mm"
RackCM RackUnit = "cm"
RackM RackUnit = "m"
RackU RackUnit = "u"
RackOU RackUnit = "ou"
RackF RackUnit = "f"
)

type LabelPosition string

const (
LabelFront LabelPosition = "front"
LabelRear LabelPosition = "rear"
LabelFrontrear LabelPosition = "frontrear"
LabelTop LabelPosition = "top"
LabelRight LabelPosition = "right"
LabelLeft LabelPosition = "left"
)

type ComponentOrientation string

const (
ComponentHorizontal ComponentOrientation = "horizontal"
ComponentVertical ComponentOrientation = "vertical"
)

type Component struct {
Factor string `json:"factor,omitempty"`
Color *Color `json:"color,omitempty"`
Expand Down
7 changes: 0 additions & 7 deletions types/site.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,6 @@ import "encoding/json"

type SiteOrientation string

const (
EN SiteOrientation = "EN"
NW SiteOrientation = "NW"
WS SiteOrientation = "WS"
SE SiteOrientation = "SE"
)

type Site struct {
Header
Orientation *SiteOrientation `json:"orientation,omitempty"`
Expand Down

0 comments on commit 3521293

Please sign in to comment.