simbad

package
v0.1.0 Latest Latest
Warning

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

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

Documentation

Overview

Package simbad is the library behind the simbad command line: the HTTP client, request shaping, and the typed data models for the SIMBAD Astronomical Database at simbad.u-strasbg.fr.

The Client here is the spine every command shares. It sets a real User-Agent, paces requests so a busy session stays polite, and retries the transient failures (429 and 5xx) that any public site throws under load.

Index

Constants

View Source
const DefaultUserAgent = "simbad-cli/0.1 (tamnd87@gmail.com)"

DefaultUserAgent identifies the client to SIMBAD. A real, honest User-Agent is both polite and the thing most likely to keep you unblocked.

View Source
const Host = "simbad.u-strasbg.fr"

Host is the site this client talks to, and the host the URI driver in domain.go claims.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client talks to SIMBAD over HTTP.

func NewClient

func NewClient(cfg ...Config) *Client

NewClient returns a Client with DefaultConfig settings.

func (*Client) QueryTAP

func (c *Client) QueryTAP(ctx context.Context, adql string) ([]Object, error)

QueryTAP executes an ADQL query and returns the matching objects.

type Config

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

Config holds all tunables for the Client.

func DefaultConfig

func DefaultConfig() Config

DefaultConfig returns safe, polite defaults.

type Domain

type Domain struct{}

Domain is the SIMBAD driver. It carries no state; the per-run client is built by the factory Register hands kit.

func (Domain) Info

func (Domain) Info() kit.DomainInfo

Info describes the scheme, the hostnames a pasted link is matched against, and the identity reused for the binary's help and version.

func (Domain) Register

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

Register installs the client factory and every operation onto app.

type Object

type Object struct {
	MainID     string  `json:"main_id"`
	RA         float64 `json:"ra"`
	Dec        float64 `json:"dec"`
	ObjectType string  `json:"object_type"`
	Redshift   float64 `json:"redshift,omitempty"`
	RadVel     float64 `json:"radial_velocity,omitempty"`
}

Object is one record from the SIMBAD basic table.

Jump to

Keyboard shortcuts

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