solarsystem

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Planets = planetsContainer{
	MERCURY: Planet{

		Gravity:             0.378,
		RadiusKm:            2439.7,
		MassKg:              3.3e+23,
		OrbitKm:             5.791e+07,
		OrbitDays:           88,
		SurfacePressureBars: 1e-10,
		Moons:               0,
		Rings:               false,
		// contains filtered or unexported fields
	},
	VENUS: Planet{

		Gravity:             0.907,
		RadiusKm:            6051.8,
		MassKg:              4.87e+24,
		OrbitKm:             1.082e+08,
		OrbitDays:           225,
		SurfacePressureBars: 92,
		Moons:               0,
		Rings:               false,
		// contains filtered or unexported fields
	},
	EARTH: Planet{

		Gravity:             1,
		RadiusKm:            6378.1,
		MassKg:              5.97e+24,
		OrbitKm:             1.496e+08,
		OrbitDays:           365,
		SurfacePressureBars: 1,
		Moons:               1,
		Rings:               false,
		// contains filtered or unexported fields
	},
	MARS: Planet{

		Gravity:             0.377,
		RadiusKm:            3389.5,
		MassKg:              6.42e+23,
		OrbitKm:             2.279e+08,
		OrbitDays:           687,
		SurfacePressureBars: 0.01,
		Moons:               2,
		Rings:               false,
		// contains filtered or unexported fields
	},
	JUPITER: Planet{

		Gravity:             2.36,
		RadiusKm:            69911,
		MassKg:              1.9e+27,
		OrbitKm:             7.786e+08,
		OrbitDays:           4333,
		SurfacePressureBars: 20,
		Moons:               4,
		Rings:               true,
		// contains filtered or unexported fields
	},
	SATURN: Planet{

		Gravity:             0.916,
		RadiusKm:            58232,
		MassKg:              5.68e+26,
		OrbitKm:             1.4335e+09,
		OrbitDays:           10759,
		SurfacePressureBars: 1,
		Moons:               7,
		Rings:               true,
		// contains filtered or unexported fields
	},
	URANUS: Planet{

		Gravity:             0.889,
		RadiusKm:            25362,
		MassKg:              8.68e+25,
		OrbitKm:             2.8725e+09,
		OrbitDays:           30687,
		SurfacePressureBars: 1.3,
		Moons:               13,
		Rings:               true,
		// contains filtered or unexported fields
	},
	NEPTUNE: Planet{

		Gravity:             1.12,
		RadiusKm:            24622,
		MassKg:              1.02e+26,
		OrbitKm:             4.4951e+09,
		OrbitDays:           60190,
		SurfacePressureBars: 1.5,
		Moons:               2,
		Rings:               true,
		// contains filtered or unexported fields
	},
}

Planets is a main entry point using the Planet type. It it a container for all enum values and provides a convenient way to access all enum values and perform operations, with convenience methods for common use cases.

Functions

func ExhaustivePlanets

func ExhaustivePlanets(f func(Planet))

ExhaustivePlanets iterates over all enum values and calls the provided function for each value. This function is useful for performing operations on all valid enum values in a loop.

Types

type Planet

type Planet struct {
	Gravity             float64
	RadiusKm            float64
	MassKg              float64
	OrbitKm             float64
	OrbitDays           float64
	SurfacePressureBars float64
	Moons               int
	Rings               bool
	// contains filtered or unexported fields
}

Planet is a type that represents a single enum value. It combines the core information about the enum constant and it's defined fields.

func ParsePlanet

func ParsePlanet(input any) (Planet, error)

ParsePlanet parses the input value into an enum value. It returns the parsed enum value or an error if the input is invalid. It is a convenience function that can be used to parse enum values from various input types, such as strings, byte slices, or other enum types.

func (Planet) IsValid

func (p Planet) IsValid() bool

IsValid checks whether the Planets value is valid. A valid value is one that is defined in the original enum and not marked as invalid.

func (Planet) MarshalBinary added in v0.3.8

func (p Planet) MarshalBinary() ([]byte, error)

MarshalBinary implements the encoding.BinaryMarshaler interface for Planet. It returns the binary representation of the enum value as a byte slice.

func (Planet) MarshalJSON

func (p Planet) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface for Planet. It returns the JSON representation of the enum value as a byte slice.

func (Planet) MarshalText added in v0.3.8

func (p Planet) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface for Planet. It returns the string representation of the enum value as a byte slice

func (Planet) MarshalYAML added in v0.4.0

func (p Planet) MarshalYAML() ([]byte, error)

MarshalYAML implements the yaml.Marshaler interface for Planet. It returns the string representation of the enum value.

func (*Planet) Scan

func (p *Planet) Scan(value any) error

Scan implements the database/sql.Scanner interface for Planet. It parses the string representation of the enum value from the database row. It returns an error if the row does not contain a valid enum value.

func (Planet) String

func (p Planet) String() string

String implements the Stringer interface. It returns the canonical absolute name of the enum value.

func (*Planet) UnmarshalBinary added in v0.3.8

func (p *Planet) UnmarshalBinary(b []byte) error

UnmarshalBinary implements the encoding.BinaryUnmarshaler interface for Planet. It parses the binary representation of the enum value from the byte slice. It returns an error if the byte slice does not contain a valid enum value.

func (*Planet) UnmarshalJSON

func (p *Planet) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the json.Unmarshaler interface for Planet. It parses the JSON representation of the enum value from the byte slice. It returns an error if the input is not a valid JSON representation.

func (*Planet) UnmarshalText added in v0.3.8

func (p *Planet) UnmarshalText(b []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface for Planet. It parses the string representation of the enum value from the byte slice. It returns an error if the byte slice does not contain a valid enum value.

func (*Planet) UnmarshalYAML added in v0.4.0

func (p *Planet) UnmarshalYAML(b []byte) error

UnmarshalYAML implements the yaml.Unmarshaler interface for Planet. It parses the byte slice representation of the enum value and returns an error if the YAML byte slice does not contain a valid enum value.

func (Planet) Value

func (p Planet) Value() (driver.Value, error)

Value implements the database/sql/driver.Valuer interface for Planet. It returns the string representation of the enum value.

Jump to

Keyboard shortcuts

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