exoplanet

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package exoplanet is the library behind the exoplanet command line: the HTTP client, request shaping, and typed data models for the NASA Exoplanet Archive TAP service (https://exoplanetarchive.ipac.caltech.edu/TAP/).

Queries are written in ADQL (SELECT TOP N ... FROM ps WHERE ...). No API key or registration is required. The Client paces requests, sets a real User-Agent, and retries transient failures (429 and 5xx).

Index

Constants

View Source
const BaseURL = "https://" + Host + "/TAP"

BaseURL is the root every TAP request is built from.

View Source
const Host = "exoplanetarchive.ipac.caltech.edu"

Host is the API hostname.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client talks to the NASA Exoplanet Archive TAP service over HTTP.

func NewClient

func NewClient(cfg Config) *Client

NewClient returns a Client configured with cfg.

func (*Client) GetByHost

func (c *Client) GetByHost(ctx context.Context, host string, limit int) ([]Planet, error)

GetByHost returns all confirmed planets orbiting a named host star.

func (*Client) GetPlanet

func (c *Client) GetPlanet(ctx context.Context, name string) (*Planet, error)

GetPlanet returns the single planet with an exact name match.

func (*Client) ListByMethod

func (c *Client) ListByMethod(ctx context.Context, method string, limit int) ([]Planet, error)

ListByMethod returns planets discovered by a given method.

func (*Client) SearchByName

func (c *Client) SearchByName(ctx context.Context, fragment string, limit int) ([]Planet, error)

SearchByName returns planets whose name contains fragment (ADQL LIKE '%fragment%').

type Config

type Config struct {
	BaseURL   string
	UserAgent string
	Rate      time.Duration
	Timeout   time.Duration
	Retries   int
}

Config holds all tunable parameters for the Client.

func DefaultConfig

func DefaultConfig() Config

DefaultConfig returns a Config with sensible defaults for the NASA TAP service.

type Domain

type Domain struct{}

Domain is the exoplanet driver for the kit framework.

func (Domain) Classify

func (Domain) Classify(input string) (string, string, error)

Classify turns any accepted input into (type, id).

func (Domain) Info

func (Domain) Info() kit.DomainInfo

Info describes the scheme, hostnames, and binary identity.

func (Domain) Locate

func (Domain) Locate(t, id string) (string, error)

Locate returns the live https URL for a (type, id).

func (Domain) Register

func (Domain) Register(app *kit.App)

Register installs the client factory and all operations onto app.

type Planet

type Planet struct {
	Name              string   `json:"name"                  kit:"id"`
	HostStar          string   `json:"host_star"`
	MassEarth         *float64 `json:"mass_earth,omitempty"`
	RadiusEarth       *float64 `json:"radius_earth,omitempty"`
	OrbitalPeriodDays *float64 `json:"orbital_period_days,omitempty"`
	DistanceParsec    *float64 `json:"distance_parsec,omitempty"`
	DiscoveryMethod   string   `json:"discovery_method,omitempty"`
	DiscoveryYear     *int     `json:"discovery_year,omitempty"`
}

Planet holds flattened planet metadata from the NASA Exoplanet Archive. Pointer fields represent measurements that may be absent (null) in the archive.

Jump to

Keyboard shortcuts

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