models

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2019 License: Apache-2.0 Imports: 8 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

func (*Dataset) AfterCreate

func (dataset *Dataset) AfterCreate(db *gorm.DB)

AfterCreate hook call to fire up a creation event

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 Event

type Event struct {
	FullID    string    `json:"full_id" example:"my-awesome-gcp-project-name:my-awesome-dataset-name"`
	Type      string    `json:"type" example:"dataset"`
	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"`
	Message   string    `` /* 138-byte string literal not displayed */
	Before    string    `json:"before" example:""`
	After     string    `json:"after" example:""`
}

Event is a struct containing event data

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

func (*Field) AfterCreate

func (field *Field) AfterCreate(db *gorm.DB)

AfterCreate hook call to fire up a creation event

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

func (*Partition) AfterCreate

func (partition *Partition) AfterCreate(db *gorm.DB)

AfterCreate hook call to fire up a creation event

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

func (*Project) AfterCreate

func (project *Project) AfterCreate(db *gorm.DB)

AfterCreate hook call to fire up a creation event

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

func (*Table) AfterCreate

func (table *Table) AfterCreate(db *gorm.DB)

AfterCreate hook call to fire up a creation event

Jump to

Keyboard shortcuts

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