bqdb

package
v0.0.0-...-2071987 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2016 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OpenAndCreateTablesIfNeeded

func OpenAndCreateTablesIfNeeded(driver string, path string, dialect gorp.Dialect) (*gorp.DbMap, error)

func QueryTotalTableBytes

func QueryTotalTableBytes(dbmap *gorp.DbMap, userID int64, projectID string) (int64, error)

TODO: Remove this? projectQuery already calls QuotedTableForQuery

func QuotedTableForQuery

func QuotedTableForQuery(dbmap *gorp.DbMap, i interface{}) (string, error)

func RegisterAndCreateTablesIfNeeded

func RegisterAndCreateTablesIfNeeded(dbmap *gorp.DbMap) error

Types

type Project

type Project struct {
	UserID       int64  `db:",notnull"`
	ProjectID    string `db:",notnull"`
	FriendlyName string `db:",notnull"`

	IsLoading      bool   `db:",notnull"`
	LoadingPercent int    `db:",notnull"`
	LoadingMessage string `db:",notnull"`
	LoadingError   string `db:",notnull"`
}

func GetProjectByID

func GetProjectByID(getter gorp.SqlExecutor, userID int64, projectID string) (*Project, error)

Returns nil, nil if there is no such user (same as dbMap.Get()). TODO: Return err?

type Table

type Table struct {
	UserID    int64
	ProjectID string
	DatasetID string
	TableID   string

	FriendlyName string `db:",notnull"`
	Description  string `db:",notnull"`

	NumBytes         int64 `db:",notnull"`
	NumLongTermBytes int64 `db:",notnull"`
	NumRows          int64 `db:",notnull"`

	CreationTimeMs     int64 `db:",notnull"`
	LastModifiedTimeMs int64 `db:",notnull"`

	StreamingEstimatedBytes int64 `db:",notnull"`
	StreamingEstimatedRows  int64 `db:",notnull"`
}

https://cloud.google.com/bigquery/docs/reference/rest/v2/tables#resource

type User

type User struct {
	ID          int64  `db:",primarykey,autoincrement"`
	AccessToken string `db:",notnull"`
}

func GetUserByAccessToken

func GetUserByAccessToken(getter gorp.SqlExecutor, accessToken string) (*User, error)

Returns nil, nil if there is no such user (same as dbMap.Get()). TODO: Return err?

func GetUserByID

func GetUserByID(getter gorp.SqlExecutor, userID int64) (*User, error)

Returns nil, nil if there is no such user (same as dbMap.Get()). TODO: Return err?

Jump to

Keyboard shortcuts

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