models

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2019 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DBOperator

type DBOperator struct {
	DB     *gorm.DB
	Config *configs.Config
	Logger *log.Logger
}

DBOperator represents a database operator instance

func (*DBOperator) ConnectDB

func (op *DBOperator) ConnectDB() (*gorm.DB, error)

ConnectDB connect to the database

func (*DBOperator) DropDB

func (op *DBOperator) DropDB()

DropDB drop the underlying tables if they exist

func (*DBOperator) MigrateDB

func (op *DBOperator) MigrateDB()

MigrateDB create the underlying tables if they don't exist

type Dataset

type Dataset struct {
	FullID                  string         `json:"full_id" example:"my-awesome-gcp-project-name:my-awesome-dataset-name" gorm:"primary_key"`
	CreatedAt               time.Time      `json:"_created_at" example:"2000-01-01T00:00:00.000Z"`
	UpdatedAt               time.Time      `json:"_updated_at" example:"2000-01-01T00:00:00.000Z"`
	Name                    string         `json:"name" example:"my-awesome-dataset-name"`
	Description             string         `json:"description" example:"This is my awesome dataset"`
	Location                string         `json:"location" example:"EU"`
	Expiration              string         `json:"expiration" example:"3600s"`
	CreationTime            time.Time      `json:"creation_time" example:"2000-01-01T00:00:00.000Z"`
	LastModifiedTime        time.Time      `json:"last_modified_time" example:"2000-01-01T00:00:00.000Z"`
	Etag                    string         `json:"etag" example:"QiKZCjFNeH22n9b0iC/ZoQ=="`
	Owners                  pq.StringArray `json:"owners" gorm:"type:text[]" example:"[projectOwners]"`
	Writers                 pq.StringArray `json:"writers" gorm:"type:text[]" example:"[projectWriters]"`
	Readers                 pq.StringArray `json:"readers" gorm:"type:text[]" example:"[projectReaders]"`
	Labels                  pq.StringArray `json:"labels" gorm:"type:text[]" example:"[key:value]"`
	TableCount              int64          `json:"table_count" example:"1000"`
	PartitionCount          int64          `json:"partition_count" example:"10000"`
	FieldCount              int64          `json:"field_count" example:"10000"`
	RowCount                int64          `json:"row_count" example:"10000"`
	ByteCount               int64          `json:"byte_count" example:"100000"`
	LatestPartition         time.Time      `json:"latest_partition" example:"2000-01-01T00:00:00.000Z"`
	LatestPartitionRowCount int64          `json:"latest_partition_row_count" example:"1000000"`
}

Dataset is a struct containing Dataset data

type Entry

type Entry struct {
	FullID string `json:"full_id" example:"my-awesome-gcp-project-name:my-awesome-dataset-name"`
	Type   string `json:"type" example:"dataset"`
}

Entry is a struct which define a project, a dataset or a table from the DB

type Field

type Field struct {
	TableFullID  string    `json:"table_full_id" example:"my-awesome-gcp-project-name:my-awesome-dataset-name.my-awesome-table-name" gorm:"primary_key"`
	Name         string    `json:"name" example:"my-awesome-field-name" gorm:"primary_key"`
	CreatedAt    time.Time `json:"_created_at" example:"2000-01-01T00:00:00.000Z"`
	UpdatedAt    time.Time `json:"_updated_at" example:"2000-01-01T00:00:00.000Z"`
	Type         string    `json:"type" example:"INTEGER"`
	Mode         string    `json:"mode" example:"NULLABLE"`
	Description  string    `json:"description" example:"This is my awesome field"`
	ColumnNumber int       `json:"-"`
}

Field is a struct containing Field data

type Partition

type Partition struct {
	TableFullID   string    `json:"table_full_id" example:"my-awesome-gcp-project-name:my-awesome-dataset-name.my-awesome-table-name" gorm:"primary_key"`
	Partitiontime time.Time `json:"partitiontime" example:"2000-01-01 00:00:00 +0000 UTC" gorm:"primary_key"`
	CreatedAt     time.Time `json:"_created_at" example:"2000-01-01T00:00:00.000Z"`
	UpdatedAt     time.Time `json:"_updated_at" example:"2000-01-01T00:00:00.000Z"`
	Count         uint64    `json:"count" example:"10000"`
}

Partition is a struct containing Partition data

type Project

type Project struct {
	FullID                  string    `json:"full_id" example:"my-awesome-gcp-project-name" gorm:"primary_key"`
	CreatedAt               time.Time `json:"_created_at" example:"2000-01-01T00:00:00.000Z"`
	UpdatedAt               time.Time `json:"_updated_at" example:"2000-01-01T00:00:00.000Z"`
	DatasetCount            int64     `json:"dataset_count" example:"100"`
	TableCount              int64     `json:"table_count" example:"1000"`
	PartitionCount          int64     `json:"partition_count" example:"10000"`
	FieldCount              int64     `json:"field_count" example:"10000"`
	RowCount                int64     `json:"row_count" example:"10000"`
	ByteCount               int64     `json:"byte_count" example:"100000"`
	LatestPartition         time.Time `json:"latest_partition" example:"2000-01-01T00:00:00.000Z"`
	LatestPartitionRowCount int64     `json:"latest_partition_row_count" example:"1000000"`
}

Project is a struct containing Project stats

type Table

type Table struct {
	FullID                  string         `json:"full_id" example:"my-awesome-gcp-project-name:my-awesome-dataset-name.my-awesome-table-name" gorm:"primary_key"`
	CreatedAt               time.Time      `json:"_created_at" example:"2000-01-01T00:00:00.000Z"`
	UpdatedAt               time.Time      `json:"_updated_at" example:"2000-01-01T00:00:00.000Z"`
	Name                    string         `json:"name" example:"my-awesome-table-name"`
	Description             string         `json:"description" example:"This is my awesome table"`
	LegacySQL               bool           `json:"legacySQL" example:"false"`
	CreationTime            time.Time      `json:"creation_time" example:"2000-01-01T00:00:00.000Z"`
	LastModifiedTime        time.Time      `json:"last_modified_time" example:"2000-01-01T00:00:00.000Z"`
	Etag                    string         `json:"etag" example:"QiKZCjFNeH22n9b0iC/ZoQ=="`
	TimePartitioning        string         `json:"time_partitioning" example:"DAY"`
	PartitionCount          int64          `json:"partition_count" example:"10000"`
	FieldCount              int64          `json:"field_count" example:"10000"`
	RowCount                uint64         `json:"row_count" example:"10000"`
	ByteCount               uint64         `json:"byte_count" example:"100000"`
	Labels                  pq.StringArray `json:"labels" gorm:"type:text[]" example:"[key:value]"`
	LatestPartition         time.Time      `json:"latest_partition" example:"2000-01-01T00:00:00.000Z"`
	LatestPartitionRowCount int64          `json:"latest_partition_row_count" example:"1000000"`
}

Table is a struct containing Table data

Jump to

Keyboard shortcuts

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