backend

package
v0.0.0-...-c83d810 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2019 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const TQCloudSQLExportAPIPath = "/tq/cloudsql/export"

TQCloudSQLExportAPIPath is Cloud SQL ExportのTaskQueue用のPath

View Source
const TQCloudSQLExportAfterAPIPath = "/tq/cloudsql/export/after"

TQCloudSQLExportAfterAPIPath is Cloud SQL Export後にOPがどうなったかを確認するTaskQueueのPath

View Source
const TQDatastoreExportAPIPath = "/tq/datastore/export"

TQDatastoreExportAPIPath is TQDatastoreExportAPI Path

Variables

View Source
var ErrCloudSQLExportMutexCollision = errors.New("collision cloud sql export mutex")

ErrCloudSQLExportMutexCollision is すでに誰かが掴んでいる時に返すエラー

Functions

func ExecuteTemplate

func ExecuteTemplate(query string, v map[string]interface{}) (string, error)

ExecuteTemplate is text template execute

func ImportBigQueryHandleFunc

func ImportBigQueryHandleFunc(datasetID string) http.HandlerFunc

ImportBigQueryHandleFunc returns a http.HandlerFunc that imports GCSObject to BigQuery.

func ReceiveCloudSQLExportOCNHandler

func ReceiveCloudSQLExportOCNHandler(ctx context.Context, w http.ResponseWriter, r *http.Request)

ReceiveCloudSQLExportOCNHandler is Cloud SQL ExportのファイルがCloud Storageに入った時にOCNを受け取り、BigQueryにUploadするためのHandler

func ReceiveCloudSQLExportPubSubHandler

func ReceiveCloudSQLExportPubSubHandler(ctx context.Context, w http.ResponseWriter, r *http.Request)

ReceiveCloudSQLExportPubSubHandler is Cloud SQL ExportのファイルCloud Storageに入った時のCloud Pus/SubのPushを受け取って解釈するHandler

func ReceiveOCNHandler

func ReceiveOCNHandler(ctx context.Context, w http.ResponseWriter, r *http.Request)

ReceiveOCNHandler is Datastore ExportのファイルがCloud Storageに入った時にBigQueryにUploadするためのOCNのHandler

func ReceivePubSubSampleHandler

func ReceivePubSubSampleHandler(ctx context.Context, w http.ResponseWriter, r *http.Request)

ReceivePubSubSampleHandler is Cloud Pus/SubのPushを受け取って解釈するHandler

func ReceiveStorageBQLoadOCNHandler

func ReceiveStorageBQLoadOCNHandler(ctx context.Context, w http.ResponseWriter, r *http.Request)

ReceiveStorageBQLoadOCNHandler is Cloud Storage load to BigQueryのOCNを受け取るためのHandler

func SetCloudSQLAdminService

func SetCloudSQLAdminService(service CloudSQLAdminService)

SetCloudSQLAdminService is Replace Imple Use it to replace with Mock with Unit Test.

func SetStorageService

func SetStorageService(service StorageService)

SetStorageService is Replace Imple Use it to replace with Mock with Unit Test.

func SetTaskQueueService

func SetTaskQueueService(service TaskQueueService)

SetTaskQueueService is Replace Imple Use it to replace with Mock with Unit Test.

func SetupBatch

func SetupBatch(swPlugin *swagger.Plugin)

func SetupBigQuery

func SetupBigQuery(swPlugin *swagger.Plugin)

func SetupCronCloudSQLExportAPI

func SetupCronCloudSQLExportAPI(swPlugin *swagger.Plugin)

func SetupCronDatastoreExportAPI

func SetupCronDatastoreExportAPI(swPlugin *swagger.Plugin)

func SetupCronQueryAPI

func SetupCronQueryAPI(swPlugin *swagger.Plugin)

func SetupScheduleAPI

func SetupScheduleAPI(swPlugin *swagger.Plugin)

func SetupScheduleCloudSQLExportAPI

func SetupScheduleCloudSQLExportAPI(swPlugin *swagger.Plugin)

func SetupScheduleDatastoreExportAPI

func SetupScheduleDatastoreExportAPI(swPlugin *swagger.Plugin)

func SetupStorageBQLoadConfigAPI

func SetupStorageBQLoadConfigAPI(swPlugin *swagger.Plugin)

func SetupTQBuildQueryAPI

func SetupTQBuildQueryAPI(swPlugin *swagger.Plugin)

func SetupTQCloudSQLExportAPI

func SetupTQCloudSQLExportAPI(swPlugin *swagger.Plugin)

func SetupTQCloudSQLExportAfterAPI

func SetupTQCloudSQLExportAfterAPI(swPlugin *swagger.Plugin)

func SetupTQDatastoreExportAPI

func SetupTQDatastoreExportAPI(swPlugin *swagger.Plugin)

Types

type BatchAPI

type BatchAPI struct{}

BatchAPI is Batch API

func (*BatchAPI) Post

Post is Batch API Post Handler

type BatchAPIPostRequest

type BatchAPIPostRequest struct {
	ProjectID         string `json:"projectID"`
	DstProjectID      string `json:"dstProjectID"`
	DstDatasetID      string `json:"dstDatasetID"`
	DstTableID        string `json:"dstTableID"`
	QueryPathBucket   string `json:"queryPathBucket"`
	QueryPathObject   string `json:"queryPathObject"`
	CreateDisposition string `json:"createDisposition"`
	StartDate         string `json:"startDate"`
	CountDate         int    `json:"countDate"`
}

BatchAPIPostRequest is Batch API Post form

type BatchAPIPostResponse

type BatchAPIPostResponse struct {
}

BatchAPIPostResponse is Batch API Post response

type BigQueryAPI

type BigQueryAPI struct{}

BigQueryAPI is BigQuery API

func (*BigQueryAPI) Post

Post is BigQuery API Post Handler

type BigQueryAPIPostRequest

type BigQueryAPIPostRequest struct {
	ProjectID         string `json:"projectID"`
	DstProjectID      string `json:"dstProjectID"`
	DstDatasetID      string `json:"dstDatasetID"`
	DstTableID        string `json:"dstTableID"`
	Query             string `json:"query"`
	QueryPathBucket   string `json:"queryPathBucket"`
	QueryPathObject   string `json:"queryPathObject"`
	CreateDisposition string `json:"createDisposition"`
}

BigQueryAPIPostRequest is BigQuery API Post form

type BigQueryAPIPostResponse

type BigQueryAPIPostResponse struct {
	JobID string `json:"jobID"`
}

BigQueryAPIPostResponse is BigQuery API Post response

type BigQueryLoadWithAutodetectParam

type BigQueryLoadWithAutodetectParam struct {
	CloudStorageURI   string
	BigQueryProjectID string
	BigQueryDataset   string
	BigQueryTable     string
	SourceFormat      string
}

BigQueryLoadWithAutodetectParam is LoadWithAutodetect Param

type BigQueryService

type BigQueryService struct{}

BigQueryService is BigQuery APIのためのService

func (*BigQueryService) BuildTableSchema

func (service *BigQueryService) BuildTableSchema(schema string) (*bigquery.TableSchema, error)

BuildTableSchema is TableSchema文字列からbigquery.TableSchemaを生成する TableSchema文字列 Example Name:STRING,Age:INTEGER

func (*BigQueryService) LoadFromCloudSQLExport

func (service *BigQueryService) LoadFromCloudSQLExport(ctx context.Context, job *ScheduleCloudSQLExportJob) error

LoadFromCloudSQLExport is Cloud SQL Export CSVをBigQueryにLoadする

func (*BigQueryService) LoadWithAutodetect

func (service *BigQueryService) LoadWithAutodetect(ctx context.Context, param *BigQueryLoadWithAutodetectParam) error

LoadWithAutodetect is BigQuery.LoadをAutodetectで実行する

type CloudSQLAdminService

type CloudSQLAdminService interface {
	Export(ctx context.Context, config *CloudSQLExportConfig) (*sqladmin.Operation, error)
	GetOp(ctx context.Context, projectID string, operation string) (*sqladmin.Operation, error)
}

CloudSQLAdminService is Cloud SQLのAdmin APIに関するService

func NewCloudSQLAdminService

func NewCloudSQLAdminService() CloudSQLAdminService

NewCloudSQLAdminService is CloudSQLAdminServiceを作成

type CloudSQLAdminServiceImpl

type CloudSQLAdminServiceImpl struct{}

CloudSQLAdminServiceImpl is Cloud SQL Adminの実装をぶらさげるstruct

func (*CloudSQLAdminServiceImpl) Export

func (service *CloudSQLAdminServiceImpl) Export(ctx context.Context, config *CloudSQLExportConfig) (*sqladmin.Operation, error)

Export is Cloud SQLにSQLを実行して、Cloud StorageにExportする

func (*CloudSQLAdminServiceImpl) GetOp

func (service *CloudSQLAdminServiceImpl) GetOp(ctx context.Context, projectID string, operation string) (*sqladmin.Operation, error)

GetOp is 指定したOperationを取得する

type CloudSQLExportConfig

type CloudSQLExportConfig struct {
	ProjectID string
	Instance  string
	Databases []string
	SQL       string
	ExportURI string
}

CloudSQLExportConfig is Cloud SQL Export API実行に必要なパラメータ

type CloudSQLExportMutex

type CloudSQLExportMutex struct {
	Key                          datastore.Key `datastore:"-"` // Cloud SQL Instance ID
	ScheduleCloudSQLExportJobKey datastore.Key // Mutexを掴んでいるJobのKey
	CreatedAt                    time.Time     `json:"createdAt"`
	UpdatedAt                    time.Time     `json:"updatedAt"`
	SchemaVersion                int           `json:"-"`
}

CloudSQLExportMutex is Cloud SQL ExportがInstanceごとに1つしか同時実行できないので、実行を管理するためのKind

func (*CloudSQLExportMutex) Load

func (model *CloudSQLExportMutex) Load(ctx context.Context, ps []datastore.Property) error

Load is Load

func (*CloudSQLExportMutex) Save

Save is Save

type CloudSQLExportMutexStore

type CloudSQLExportMutexStore struct{}

CloudSQLExportMutexStore is CloudSQLExportMutex Function

func (*CloudSQLExportMutexStore) Key

func (store *CloudSQLExportMutexStore) Key(ctx context.Context, client datastore.Client, projectID string, instance string) datastore.Key

Key is Create CloudSQLExportMutex Key

func (*CloudSQLExportMutexStore) Kind

func (store *CloudSQLExportMutexStore) Kind() string

Kind is Get CloudSQLExportMutex Kind Name

func (*CloudSQLExportMutexStore) Lock

func (store *CloudSQLExportMutexStore) Lock(ctx context.Context, projectID string, instance string, jobKey datastore.Key) error

Lock is Make the state that grabbed the specified mutex. If already grabbed, ErrCloudSQLExportMutexCollision is returned. 指定したMutexを掴んだ状態にする。すでに掴まれていた場合は、ErrCloudSQLExportMutexCollision が返ってくる。

func (*CloudSQLExportMutexStore) Unlock

func (store *CloudSQLExportMutexStore) Unlock(ctx context.Context, projectID string, instance string, jobKey datastore.Key) error

Unlock is Release the grabbing Mutex. 掴んでいるMutexを解放する。

type CronCloudSQLExportAPI

type CronCloudSQLExportAPI struct{}

CronCloudSQLExportAPI is Cron Cloud SQL Export API

func (*CronCloudSQLExportAPI) Get

Get is Cron Datastore Export API Handler

type CronDatastoreExportAPI

type CronDatastoreExportAPI struct{}

CronDatastoreExportAPI is Cron Datastore Export API

func (*CronDatastoreExportAPI) Get

Get is Cron Datastore Export API Handler

type CronQueryAPI

type CronQueryAPI struct{}

CronQueryAPI is Cron run to Query API

func (*CronQueryAPI) Get

func (api *CronQueryAPI) Get(ctx context.Context) error

Get is CronQueryAPI Get Handler

type DS2BQService

type DS2BQService interface {
	Export(ctx context.Context, form *DatastoreExportForm) error
}

DS2BQService is Datastore to BigQuery Service

func NewDS2BQService

func NewDS2BQService() DS2BQService

NewDS2BQService is New DS2BQService

type DS2BQServiceImple

type DS2BQServiceImple struct{}

DS2BQServiceImple is Default DS2BQService

func (*DS2BQServiceImple) Export

Export is Datastore Export to Cloud Storage Job Insert

type DatastoreExportForm

type DatastoreExportForm struct {
	ProjectID string
	Bucket    string
	Kinds     []string
}

DatastoreExportForm is Export Request Param

type GCSObjectToBQJobReq

type GCSObjectToBQJobReq struct {
	Bucket      string    `json:"bucket"`
	FilePath    string    `json:"filePath"`
	KindName    string    `json:"kindName"`
	TimeCreated time.Time `json:"TimeCreated"`
}

GCSObjectToBQJobReq means request of OCN to BQ.

func DecodeGCSObjectToBQJobReq

func DecodeGCSObjectToBQJobReq(r io.Reader) (*GCSObjectToBQJobReq, error)

DecodeGCSObjectToBQJobReq decodes a GCSObjectToBQJobReq from r.

type Plugger

type Plugger interface {
	Plugin() Plugin
}

Plugger supply Plugin component.

type Plugin

type Plugin interface {
	Init(typeName string)
	Ancestor(ancestor datastore.Key)
	KeysOnly()
	Start(cur datastore.Cursor)
	Offset(offset int)
	Limit(limit int)
	Filter(name, op string, value interface{})
	Asc(name string)
	Desc(name string)
}

Plugin supply hook point for query constructions.

type Schedule

type Schedule struct {
	Key datastore.Key `json:"-" datastore:"-"`
	// TODO API Response用のKeyを入れる
	ProjectID       string    `json:"projectID"`
	DstProjectID    string    `json:"dstProjectID"`
	DstDatasetID    string    `json:"dstDatasetID"`
	DstTableID      string    `json:"dstTableID"`
	QueryPathBucket string    `json:"queryPathBucket"`
	QueryPathObject string    `json:"queryPathObject"`
	ScheduleV1      string    `json:"scheduleV1"`
	CreatedAt       time.Time `json:"createdAt"`
	UpdatedAt       time.Time `json:"updatedAt"`
	SchemaVersion   int       `json:"-"`
}

Schedule is Schedule Model

func (*Schedule) Load

func (model *Schedule) Load(ctx context.Context, ps []datastore.Property) error

Load is Load

func (*Schedule) Save

func (model *Schedule) Save(ctx context.Context) ([]datastore.Property, error)

Save is Save

type ScheduleAPI

type ScheduleAPI struct{}

ScheduleAPI is Schedule API

func (*ScheduleAPI) Post

Post is Schedule API Post Handler

type ScheduleAPIPostRequest

type ScheduleAPIPostRequest struct {
	ProjectID         string `json:"projectID"`
	DstProjectID      string `json:"dstProjectID"`
	DstDatasetID      string `json:"dstDatasetID"`
	DstTableID        string `json:"dstTableID"`
	QueryPathBucket   string `json:"queryPathBucket"`
	QueryPathObject   string `json:"queryPathObject"`
	CreateDisposition string `json:"createDisposition"`
	ScheduleV1        string `json:"scheduleV1"`
	ScheduleTimezone  string `json:"scheduleTimezone"`
}

ScheduleAPIPostRequest is Schedule API Post form

type ScheduleAPIPostResponse

type ScheduleAPIPostResponse struct {
	*Schedule
}

ScheduleAPIPostResponse is Schedule API Post response

type ScheduleCloudSQLExport

type ScheduleCloudSQLExport struct {
	Key                 datastore.Key `json:"-" datastore:"-"`
	ProjectID           string        `json:"projectID"`           // ExportするCloudSQLが存在するProjectID
	Instance            string        `json:"instance"`            // ExportするCloudSQLのInstanceID
	Databases           []string      `json:"databases"`           // ExportするCloudSQLのDatabase
	SQLBucket           string        `json:"sqlBucket"`           // Export時に利用するSQLを置いているGCS Bucket. hoge
	SQLObject           string        `json:"sqlObject"`           // Export時に利用するSQLを置いているGCS Object. export.sql
	ExportURI           string        `json:"exportURI"`           // Export先のGCS Path. %sを入れるとyyyyMMddhhmmに置き換える gs://hoge/%s/fuga.csv
	BigQueryProjectID   string        `json:"bigQueryProjectID"`   // Load先のBigQuery ProjectID
	BigQueryDataset     string        `json:"bigQueryDataset"`     // Load先のBigQuery Dataset
	BigQueryTable       string        `json:"bigQueryTable"`       // Load先のBigQuery Table
	BigQueryTableSchema string        `json:"bigQueryTableSchema"` // LoadするのBigQueryTableのSchema文字列 Ex. Name:STRING,Age:INTEGER
	CreatedAt           time.Time     `json:"createdAt"`
	UpdatedAt           time.Time     `json:"updatedAt"`
	SchemaVersion       int           `json:"-"`
}

ScheduleCloudSQLExport is Cloud SQLをExportするScheduleの設定 +qgb

func (*ScheduleCloudSQLExport) Load

Load is Load

func (*ScheduleCloudSQLExport) Save

Save is Save

type ScheduleCloudSQLExportAPI

type ScheduleCloudSQLExportAPI struct{}

ScheduleCloudSQLExportAPI is CloudSQLのExport ConfigのScheduleのためのAPI

func (*ScheduleCloudSQLExportAPI) Post

Post is ScheduleCloudSQLExportAPI Post Handler ScheduleCloudSQLExportを新規にDatastoreにPutする

type ScheduleCloudSQLExportAPIPostRequest

type ScheduleCloudSQLExportAPIPostRequest struct {
	ProjectID           string   `json:"projectID"`           // ExportするCloudSQLが存在するProjectID
	Instance            string   `json:"instance"`            // ExportするCloudSQLのInstanceID
	Databases           []string `json:"databases"`           // ExportするCloudSQLのDatabase
	SQLBucket           string   `json:"sqlBucket"`           // Export時に利用するSQLを置いているGCS Bucket. hoge
	SQLObject           string   `json:"sqlObject"`           // Export時に利用するSQLを置いているGCS Object. export.sql
	ExportURI           string   `json:"exportURI"`           // Export先のGCS Path. %sを入れるとyyyyMMddhhmmに置き換える gs://hoge/%s/fuga.csv
	BigQueryProjectID   string   `json:"bigQueryProjectID"`   // Load先のBigQuery ProjectID
	BigQueryDataset     string   `json:"bigQueryDataset"`     // Load先のBigQuery Dataset
	BigQueryTable       string   `json:"bigQueryTable"`       // Load先のBigQuery Table
	BigQueryTableSchema string   `json:"bigQueryTableSchema"` // LoadするのBigQueryTableのSchema文字列 Ex. Name:STRING,Age:INTEGER
}

ScheduleCloudSQLExportAPIPostRequest is Post Param

type ScheduleCloudSQLExportAPIPostResponse

type ScheduleCloudSQLExportAPIPostResponse struct {
	*ScheduleCloudSQLExport
}

ScheduleCloudSQLExportAPIPostResponse is Post Response

type ScheduleCloudSQLExportJob

type ScheduleCloudSQLExportJob struct {
	Key                 datastore.Key `json:"-" datastore:"-"`     // ExportURIをKey Nameとして利用する
	ProjectID           string        `json:"projectID"`           // ExportするCloudSQLが存在するProjectID
	Instance            string        `json:"instance"`            // ExportするCloudSQLのInstanceID
	Databases           []string      `json:"databases"`           // ExportするCloudSQLのDatabase
	SQLBucket           string        `json:"sqlBucket"`           // Export時に利用するSQLを置いているGCS Bucket. hoge
	SQLObject           string        `json:"sqlObject"`           // Export時に利用するSQLを置いているGCS Object. export.sql
	ExportURI           string        `json:"exportURI"`           // Export先のGCS Path gs://hoge/yyyyMMddhhmm/fuga.csv
	BigQueryProjectID   string        `json:"bigQueryProjectID"`   // Load先のBigQuery ProjectID
	BigQueryDataset     string        `json:"bigQueryDataset"`     // Load先のBigQuery Dataset
	BigQueryTable       string        `json:"bigQueryTable"`       // Load先のBigQuery Table
	BigQueryTableSchema string        `json:"bigQueryTableSchema"` // LoadするのBigQueryTableのSchema文字列 Ex. Name:STRING,Age:INTEGER
	CreatedAt           time.Time     `json:"createdAt"`
	UpdatedAt           time.Time     `json:"updatedAt"`
	SchemaVersion       int           `json:"-"`
}

ScheduleCloudSQLExportJob is Cloud SQL Exportを実行した時のJob Cloud SQL Exportを実行する度に1件生成される

func (*ScheduleCloudSQLExportJob) Load

Load is Load

func (*ScheduleCloudSQLExportJob) Save

Save is Save

type ScheduleCloudSQLExportJobStore

type ScheduleCloudSQLExportJobStore struct{}

ScheduleCloudSQLExportJobStore is Schedule Cloud SQL Export Job Function

func (*ScheduleCloudSQLExportJobStore) Get

Get is ScheduleCloudSQLExportJob をDatastoreからGetする

func (*ScheduleCloudSQLExportJobStore) Key

Key is Create ScheduleCloudSQLExportJob Key idにはExportURIを指定する

func (*ScheduleCloudSQLExportJobStore) Kind

func (store *ScheduleCloudSQLExportJobStore) Kind() string

Kind is Get ScheduleCloudSQLExportJob Kind Name

func (*ScheduleCloudSQLExportJobStore) Put

Put is ScheduleCloudSQLExportJob をDatastoreにPutする

type ScheduleCloudSQLExportQueryBuilder

type ScheduleCloudSQLExportQueryBuilder struct {
	ProjectID     *ScheduleCloudSQLExportQueryProperty
	Databases     *ScheduleCloudSQLExportQueryProperty
	SQLBucket     *ScheduleCloudSQLExportQueryProperty
	SQLObject     *ScheduleCloudSQLExportQueryProperty
	ExportURI     *ScheduleCloudSQLExportQueryProperty
	CreatedAt     *ScheduleCloudSQLExportQueryProperty
	UpdatedAt     *ScheduleCloudSQLExportQueryProperty
	SchemaVersion *ScheduleCloudSQLExportQueryProperty
	// contains filtered or unexported fields
}

ScheduleCloudSQLExportQueryBuilder build query for ScheduleCloudSQLExport.

func NewScheduleCloudSQLExportQueryBuilder

func NewScheduleCloudSQLExportQueryBuilder(client datastore.Client) *ScheduleCloudSQLExportQueryBuilder

NewScheduleCloudSQLExportQueryBuilder create new ScheduleCloudSQLExportQueryBuilder.

func NewScheduleCloudSQLExportQueryBuilderWithKind

func NewScheduleCloudSQLExportQueryBuilderWithKind(client datastore.Client, kind string) *ScheduleCloudSQLExportQueryBuilder

NewScheduleCloudSQLExportQueryBuilderWithKind create new ScheduleCloudSQLExportQueryBuilder with specific kind.

func (*ScheduleCloudSQLExportQueryBuilder) Ancestor

Ancestor sets parent key to ancestor query.

func (*ScheduleCloudSQLExportQueryBuilder) KeysOnly

KeysOnly sets keys only option to query.

func (*ScheduleCloudSQLExportQueryBuilder) Limit

Limit setup to query.

func (*ScheduleCloudSQLExportQueryBuilder) Offset

Offset setup to query.

func (*ScheduleCloudSQLExportQueryBuilder) Query

Query returns *datastore.Query.

func (*ScheduleCloudSQLExportQueryBuilder) Start

Start setup to query.

type ScheduleCloudSQLExportQueryProperty

type ScheduleCloudSQLExportQueryProperty struct {
	// contains filtered or unexported fields
}

ScheduleCloudSQLExportQueryProperty has property information for ScheduleCloudSQLExportQueryBuilder.

func (*ScheduleCloudSQLExportQueryProperty) Asc

Asc order.

func (*ScheduleCloudSQLExportQueryProperty) Desc

Desc order.

func (*ScheduleCloudSQLExportQueryProperty) Equal

Equal filter with value.

func (*ScheduleCloudSQLExportQueryProperty) Filter

Filter with op & value.

func (*ScheduleCloudSQLExportQueryProperty) GreaterThan

GreaterThan filter with value.

func (*ScheduleCloudSQLExportQueryProperty) GreaterThanOrEqual

func (p *ScheduleCloudSQLExportQueryProperty) GreaterThanOrEqual(value interface{}) *ScheduleCloudSQLExportQueryBuilder

GreaterThanOrEqual filter with value.

func (*ScheduleCloudSQLExportQueryProperty) LessThan

LessThan filter with value.

func (*ScheduleCloudSQLExportQueryProperty) LessThanOrEqual

func (p *ScheduleCloudSQLExportQueryProperty) LessThanOrEqual(value interface{}) *ScheduleCloudSQLExportQueryBuilder

LessThanOrEqual filter with value.

type ScheduleCloudSQLExportStore

type ScheduleCloudSQLExportStore struct{}

ScheduleCloudSQLExportStore is Schedule Cloud SQL Export Function

func (*ScheduleCloudSQLExportStore) Key

Key is Create ScheduleCloudSQLExport Key

func (*ScheduleCloudSQLExportStore) Kind

func (store *ScheduleCloudSQLExportStore) Kind() string

Kind is Get ScheduleCloudSQLExport Kind Name

func (*ScheduleCloudSQLExportStore) ListAll

ListAll is ScheduleCloudSQLExportStore を全件取得する

func (*ScheduleCloudSQLExportStore) NewKey

NewKey is Create ScheduleCloudSQLExport Model Key

func (*ScheduleCloudSQLExportStore) Put

Put is ScheduleCloudSQLExportをDatastoreにPutする

type ScheduleDatastoreExport

type ScheduleDatastoreExport struct {
	Key           datastore.Key `json:"-" datastore:"-"`
	ProjectID     string        `json:"projectID"`
	Kinds         []string      `json:"kinds"`
	Bucket        string        `json:"bucket"`
	CreatedAt     time.Time     `json:"createdAt"`
	UpdatedAt     time.Time     `json:"updatedAt"`
	SchemaVersion int           `json:"-"`
}

ScheduleDatastoreExport is ScheduleDatastoreExport Model

func (*ScheduleDatastoreExport) Load

Load is Load

func (*ScheduleDatastoreExport) Save

Save is Save

type ScheduleDatastoreExportAPI

type ScheduleDatastoreExportAPI struct{}

ScheduleDatastoreExportAPI is Datastore ExportのScheduleのためのAPI

func (*ScheduleDatastoreExportAPI) Post

Post is ScheduleDatastoreExportAPI API Post Handler

type ScheduleDatastoreExportAPIPostRequest

type ScheduleDatastoreExportAPIPostRequest struct {
	ProjectID string   `json:"projectID"`
	Kinds     []string `json:"kinds"`
	Bucket    string   `json:"bucket"`
}

ScheduleDatastoreExportAPIPostRequest is ScheduleDatastoreExport API Post form

type ScheduleDatastoreExportAPIPostResponse

type ScheduleDatastoreExportAPIPostResponse struct {
	*ScheduleDatastoreExport
}

ScheduleDatastoreExportAPIPostResponse is ScheduleDatastoreExport API Post response

type ScheduleDatastoreExportStore

type ScheduleDatastoreExportStore struct{}

ScheduleDatastoreExportStore is Schedule Datastore Function

func (*ScheduleDatastoreExportStore) Key

Key is Create Schedule Model Key

func (*ScheduleDatastoreExportStore) Kind

func (store *ScheduleDatastoreExportStore) Kind() string

Kind is Get Schedule Kind Name

func (*ScheduleDatastoreExportStore) ListAll

ListAll is Get All Schedule

func (*ScheduleDatastoreExportStore) NewKey

NewKey is Create Schedule Model Key for New Entity

func (*ScheduleDatastoreExportStore) Put

Put is Schedule put to Datastore

func (*ScheduleDatastoreExportStore) QueryByBucket

func (store *ScheduleDatastoreExportStore) QueryByBucket(ctx context.Context, bucket string) ([]*ScheduleDatastoreExport, error)

QueryByBucket is Bucketが一致するEntity Listを取得する

type ScheduleStore

type ScheduleStore struct{}

ScheduleStore is Schedule Datastore Function

func (*ScheduleStore) Key

func (store *ScheduleStore) Key(ctx context.Context, client datastore.Client, id string) datastore.Key

Key is Create Schedule Model Key

func (*ScheduleStore) Kind

func (store *ScheduleStore) Kind() string

Kind is Get Schedule Kind Name

func (*ScheduleStore) ListAll

func (store *ScheduleStore) ListAll(ctx context.Context) ([]*Schedule, error)

ListAll is Get All Schedule

func (*ScheduleStore) NewKey

func (store *ScheduleStore) NewKey(ctx context.Context, client datastore.Client) datastore.Key

NewKey is Create Schedule Model Key for New Entity

func (*ScheduleStore) Put

func (store *ScheduleStore) Put(ctx context.Context, key datastore.Key, schedule *Schedule) (*Schedule, error)

Put is Schedule put to Datastore

type StorageBQLoadConfig

type StorageBQLoadConfig struct {
	Key                  datastore.Key `json:"-" datastore:"-"`
	FrmStorageBucket     string        `json:"frmStorageBucket"`     // LoadするFileがあるCloud Storage Bucket
	DstBigQueryProjectID string        `json:"dstBigQueryProjectID"` // Load先のBigQueryのProjectID
	DstBigQueryDataset   string        `json:"dstBigQueryDataset"`   // Load先のBigQueryのDataset
	CreatedAt            time.Time     `json:"createdAt"`
	UpdatedAt            time.Time     `json:"updatedAt"`
	SchemaVersion        int           `json:"-"`
}

StorageBQLoadConfig is Cloud Storage上に置かれたFileをBigQueryにLoadするための設定 File名と同じTable名 かつ スキーマはAutoDetectで設定するのを前提にしているので、設定項目は最小限

func (*StorageBQLoadConfig) Load

func (model *StorageBQLoadConfig) Load(ctx context.Context, ps []datastore.Property) error

Load is Load

func (*StorageBQLoadConfig) Save

Save is Save

type StorageBQLoadConfigAPI

type StorageBQLoadConfigAPI struct{}

StorageBQLoadConfigAPI is Cloud StorageにUploadされたファイルをBigQueryにLoadするConfigに関するAPI

func (*StorageBQLoadConfigAPI) Post

Post is Payloadの情報を元に StorageBQLoadConfig を新規でDatastoreに登録するAPI Handler

type StorageBQLoadConfigAPIPostRequest

type StorageBQLoadConfigAPIPostRequest struct {
	FrmStorageBucket     string `json:"frmStorageBucket"`
	DstBigQueryProjectID string `json:"dstBigQueryProjectID"`
	DstBigQueryDataset   string `json:"dstBigQueryDataset"`
}

StorageBQLoadConfigAPIPostRequest is StorageBQLoadConfigAPI Post form

type StorageBQLoadConfigAPIPostResponse

type StorageBQLoadConfigAPIPostResponse struct {
	*StorageBQLoadConfig
}

StorageBQLoadConfigAPIPostResponse is StorageBQLoadConfigAPI Post response

type StorageBQLoadConfigStore

type StorageBQLoadConfigStore struct{}

StorageBQLoadConfigStore is StorageBQLoadConfig Functions

func (*StorageBQLoadConfigStore) Get

Get is StorageBQLoadConfig をDatastoreからGetする

func (*StorageBQLoadConfigStore) Key

func (store *StorageBQLoadConfigStore) Key(ctx context.Context, client datastore.Client, bucket string) datastore.Key

Key is Create StorageBQLoadConfig Key Keyの値にはCloud StorageのBucketを利用する OCNを受け取った時に、どこにLoadするかを見るためにEntityを取得するため

func (*StorageBQLoadConfigStore) Kind

func (store *StorageBQLoadConfigStore) Kind() string

Kind is Get StorageBQLoadConfigStore Kind Name

func (*StorageBQLoadConfigStore) Put

Put is StorageBQLoadConfig をDatastoreにPutする

type StorageService

type StorageService interface {
	GetObject(ctx context.Context, bucket string, object string) (string, error)
}

StorageService is Cloud Storage Service Interface

func NewStorageService

func NewStorageService() StorageService

NewStorageService is New Storage Service

type StorageServiceImpl

type StorageServiceImpl struct{}

StorageServiceImpl is Default StorageService

func (*StorageServiceImpl) GetObject

func (service *StorageServiceImpl) GetObject(ctx context.Context, bucket string, object string) (string, error)

GetObject is Download from Cloud Storage Object

type TQBuildQueryAPI

type TQBuildQueryAPI struct{}

TQBuildQueryAPI is Build Query API

func (*TQBuildQueryAPI) Post

Post is TQBuildQueryAPI Post Handler

type TQBuildQueryAPIPostRequest

type TQBuildQueryAPIPostRequest struct {
	ProjectID         string    `json:"projectID"`
	DstProjectID      string    `json:"dstProjectID"`
	DstDatasetID      string    `json:"dstDatasetID"`
	DstTableID        string    `json:"dstTableID"`
	QueryPathBucket   string    `json:"queryPathBucket"`
	QueryPathObject   string    `json:"queryPathObject"`
	CreateDisposition string    `json:"createDisposition"`
	TargetDate        time.Time `json:"targetDate"`
}

TQBuildQueryAPIPostRequest is Build Query API Post form

type TQBuildQueryAPIPostResponse

type TQBuildQueryAPIPostResponse struct {
}

TQBuildQueryAPIPostResponse is Build Query API Post response

type TQCloudSQLExportAPI

type TQCloudSQLExportAPI struct{}

TQCloudSQLExportAPI is Cloud SQL ExportのAPIを呼び出すTask Queue API

func (*TQCloudSQLExportAPI) Call

Call is Add to Cloud SQL Export Task

func (*TQCloudSQLExportAPI) Post

Post is Task Queue Handler

type TQCloudSQLExportAPIAfterPostRequest

type TQCloudSQLExportAPIAfterPostRequest struct {
	ProjectID string `json:"projectId"`
	Instance  string `json:"instance"`
	Operation string `json:"operation"`
	JobKey    string `json:"jobKey"`
}

TQCloudSQLExportAPIAfterPostRequest is Request Payload

type TQCloudSQLExportAPIPostRequest

type TQCloudSQLExportAPIPostRequest struct {
	ProjectID           string   `json:"projectID"`           // ExportするCloudSQLが存在するProjectID
	Instance            string   `json:"instance"`            // ExportするCloudSQLのInstanceID
	Databases           []string `json:"databases"`           // ExportするCloudSQLのDatabase
	SQLBucket           string   `json:"sqlBucket"`           // Export時に利用するSQLを置いているGCS Bucket. hoge
	SQLObject           string   `json:"sqlObject"`           // Export時に利用するSQLを置いているGCS Object. fuga.csv
	ExportURI           string   `json:"exportURI"`           // Export先のGCS Path. %sを入れるとyyyyMMddhhmmに置き換える gs://hoge/%s/fuga.csv
	BigQueryProjectID   string   `json:"bigQueryProjectID"`   // Load先のBigQuery ProjectID
	BigQueryDataset     string   `json:"bigQueryDataset"`     // Load先のBigQuery Dataset
	BigQueryTable       string   `json:"bigQueryTable"`       // Load先のBigQuery Table
	BigQueryTableSchema string   `json:"bigQueryTableSchema"` // LoadするのBigQueryTableのSchema文字列 Ex. Name:STRING,Age:INTEGER
}

TQCloudSQLExportAPIPostRequest is

type TQCloudSQLExportAfterAPI

type TQCloudSQLExportAfterAPI struct{}

TQCloudSQLExportAfterAPI is Cloud SQL Export後にOPがどうなったかを確認するTask Queue API

func (*TQCloudSQLExportAfterAPI) Call

Call is Add to Cloud SQL Export After Task

func (*TQCloudSQLExportAfterAPI) Post

Post is Task Queue Handler

type TQDatastoreExportAPI

type TQDatastoreExportAPI struct {
}

TQDatastoreExportAPI is Datastore Export Job Start API

func (*TQDatastoreExportAPI) Call

Call is Add to Task

func (*TQDatastoreExportAPI) Post

Post is Datastore Export Job Start API Handler

type TQDatastoreExportAPIPostRequest

type TQDatastoreExportAPIPostRequest struct {
	ProjectID string   `json:"projectID"`
	Bucket    string   `json:"bucket"`
	Kinds     []string `json:"kinds"`
}

TQDatastoreExportAPIPostRequest is Datastore Export Job Start API Post form

type TaskQueueService

type TaskQueueService interface {
	Add(ctx context.Context, task *taskqueue.Task, queueName string) (*taskqueue.Task, error)
}

TaskQueueService is TaskQueueService Interface

func NewTaskQueueService

func NewTaskQueueService() TaskQueueService

NewTaskQueueService is New TaskQueueService

type TaskQueueServiceImpl

type TaskQueueServiceImpl struct{}

TaskQueueServiceImpl is Default TaskQueueService

func (*TaskQueueServiceImpl) Add

func (s *TaskQueueServiceImpl) Add(ctx context.Context, task *taskqueue.Task, queueName string) (*taskqueue.Task, error)

Add is Task add to queue

Jump to

Keyboard shortcuts

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