api

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultScheme = "https"
	DefaultHost   = "www.alphavantage.co"
	DefaultPath   = "/query"
)
View Source
const DefaultDateFormat = "2006-01-02"

DefaultDateFormat is the RFC 3339 date format used for parsing dates.

Variables

This section is empty.

Functions

func ParseCSV

func ParseCSV[T any](r io.Reader, data *[]T, location *time.Location) error

ParseCSV parses CSV data into a slice of structs using reflection.

Supported field types:

  • string: Direct mapping from CSV column value
  • int: Parsed using strconv.ParseInt with base 10
  • float64: Parsed using strconv.ParseFloat
  • time.Time: Parsed using time.ParseInLocation (see time-layout tag)

Struct field tags:

  • `column-name:"header"`: Maps field to CSV column header (required)
  • `time-layout:"layout"`: Custom time format for time.Time fields (optional, defaults to "2006-01-02")

Example struct:

type StockPrice struct {
    Date   time.Time `column-name:"timestamp"`
    Open   float64   `column-name:"open"`
    High   float64   `column-name:"high"`
    Volume int       `column-name:"volume"`
}

Unmapped columns are ignored. Fields without matching columns keep their zero value. Time fields with "null" values remain as zero time.Time.

Types

This section is empty.

Jump to

Keyboard shortcuts

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