Documentation
¶
Overview ¶
Package dbvar is the library behind the dbvar command line: the HTTP client, request shaping, and the typed data models for NCBI dbVar.
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 the eUtils API throws under load.
Index ¶
- Constants
- type Client
- func (c *Client) FetchRecords(ctx context.Context, ids []string) ([]*Record, error)
- func (c *Client) GetRecord(ctx context.Context, uid string) (*Record, error)
- func (c *Client) Search(ctx context.Context, query string, limit, start int) ([]string, int, error)
- func (c *Client) SearchAndFetch(ctx context.Context, query string, limit, start int) ([]*Record, int, error)
- type Config
- type Domain
- type Record
Constants ¶
const Host = "eutils.ncbi.nlm.nih.gov"
Host is the eUtils hostname 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 NCBI eUtils for dbVar records.
func (*Client) FetchRecords ¶
FetchRecords fetches record details for the given IDs (up to ~500 per call; callers should batch if needed).
type Config ¶
type Config struct {
BaseURL string
Rate time.Duration
Retries int
Timeout time.Duration
UserAgent string
}
Config holds the runtime settings for the dbVar client.
func DefaultConfig ¶
func DefaultConfig() Config
DefaultConfig returns a Config with sensible defaults: 400ms rate limit, 3 retries, and a 30s timeout.
type Domain ¶
type Domain struct{}
Domain is the dbVar driver. It carries no state; the per-run client is built by the factory Register hands kit.
func (Domain) Classify ¶
Classify turns any accepted input into the canonical (type, id). dbVar numeric UIDs are all digits.
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.
type Record ¶
type Record struct {
ID string `json:"id" kit:"id"`
Type string `json:"type"`
StudyAccession string `json:"study_accession,omitempty"`
VariantAccession string `json:"variant_accession,omitempty"`
StudyType string `json:"study_type,omitempty"`
VariantCount int `json:"variant_count,omitempty"`
Organism string `json:"organism,omitempty"`
Assemblies []string `json:"assemblies,omitempty"`
VariantTypes []string `json:"variant_types,omitempty"`
ClinSig []string `json:"clinical_significance,omitempty"`
Publications []string `json:"publications,omitempty"` // "Author Year" from publication_name
}
Record is a single dbVar record, either a study (Type=="STUDY") or a structural variant (Type=="VARIANT").