location

package
v1.3.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 1, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Location

type Location struct {
	Region     string `json:"region"`      // Geographic region
	DataCenter string `json:"data_center"` // Data center identifier
	Room       string `json:"room"`        // Room identifier
	Position   string `json:"position"`    // Specific position within room
}

Location represents location information for devices

func New

func New(b []byte) Location

New creates a Location from JSON bytes Returns a Location with "" values if unmarshaling fails

func (*Location) BuildPatchedLocation

func (loc *Location) BuildPatchedLocation(cur *Location) *Location

BuildPatchedLocation builds a patched location from the current location and the input location. It goes through the patchable fields and builds the patched location. If there is no change on patchable fields, it returns nil.

func (*Location) Encode

func (loc *Location) Encode() string

Encode serializes the Location to a JSON string. It returns "" if marshaling fails

func (*Location) ToMap

func (loc *Location) ToMap() map[string]any

ToMap converts the Location to a map[string]any, including only non-empty fields. Returns nil if loc is nil or all fields are empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL