treasuredata

package module
v0.0.0-...-3175890 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2017 License: MIT Imports: 11 Imported by: 18

README

go-treasuredata

Go interface to Treasure Data

Installation

$ go get github.com/mattn/go-treasuredata

Usage

client := treasuredata.NewClient("TREASUREDATA-API-KEY")
job, _ := client.JobIssueHive("mydb", "select * from mytable")
client.JobResultFunc(job.JobId, func(row []interface{}) error {
	fmt.Println(row)
	return nil
})

License

MIT

Author

Yasuhiro Matsumoto (a.k.a mattn)

Documentation

Index

Constants

View Source
const EndPoint = "https://api.treasure-data.com"

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	*http.Client
	Debug bool
	// contains filtered or unexported fields
}

func NewClient

func NewClient(apikey string) *Client

func (*Client) DatabaseList

func (c *Client) DatabaseList() ([]Database, error)

func (*Client) JobIssueHive

func (c *Client) JobIssueHive(database string, query string) (*Job, error)

func (*Client) JobIssueHiveWithPriority

func (c *Client) JobIssueHiveWithPriority(database string, query string, priority int) (*Job, error)

func (*Client) JobResultColumnsFunc

func (c *Client) JobResultColumnsFunc(jobId string, cb func([]string) error) error

func (*Client) JobResultFunc

func (c *Client) JobResultFunc(jobId string, cb func([]interface{}) error) error

func (*Client) JobResultLineFunc

func (c *Client) JobResultLineFunc(jobId string, cb func(string) error) error

func (*Client) JobStatus

func (c *Client) JobStatus(jobId string) (*Status, error)

func (*Client) TableList

func (c *Client) TableList(database string) ([]Table, error)

type Column

type Column struct {
	Name string
	Type string
}

type Database

type Database struct {
	Name      string `json:"name"`
	Count     int64  `json:"count"`
	CreatedAt tdTime `json:"created_at"`
}

type Job

type Job struct {
	JobId string `json:"job_id"`
}

type Status

type Status struct {
	JobId     string  `json:"job_id"`
	Status    string  `json:"status"`
	CreatedAt tdTime  `json:"created_at"`
	UpdatedAt tdTime  `json:"updated_at"`
	StartAt   tdTime  `json:"start_at"`
	EndAt     *tdTime `json:"end_at"`
}

type Table

type Table struct {
	Id                   int64    `json:"id"`
	Name                 string   `json:"name"`
	Schema               tdSchema `json:"schema"`
	EstimatedStorageSize int64    `json:"estimated_storage_size"`
	CounterUpdatedAt     tdTime   `json:"counter_updated_at"`
	Type                 string   `json:"type"`
	Count                int64    `json:"count"`
	CreatedAt            tdTime   `json:"created_at"`
	UpdatedAt            tdTime   `json:"updated_at"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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