cmd

package
v0.0.0-...-3732a2f Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2020 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AddColumnsQuery = []string{
	"ALTER TABLE Albums ADD COLUMN MarketingBudget INT64",
}

カラムの追加

View Source
var AddRecords = []*spanner.Mutation{
	spanner.InsertOrUpdate("Singers", singerColumns, []interface{}{1, "Marc", "Richards"}),
	spanner.InsertOrUpdate("Singers", singerColumns, []interface{}{2, "Catalina", "Smith"}),
	spanner.InsertOrUpdate("Singers", singerColumns, []interface{}{3, "Alice", "Trentor"}),
	spanner.InsertOrUpdate("Singers", singerColumns, []interface{}{4, "Lea", "Martin"}),
	spanner.InsertOrUpdate("Singers", singerColumns, []interface{}{5, "David", "Lomond"}),
	spanner.InsertOrUpdate("Albums", albumColumns, []interface{}{1, 1, "Total Junk"}),
	spanner.InsertOrUpdate("Albums", albumColumns, []interface{}{1, 2, "Go, Go, Go"}),
	spanner.InsertOrUpdate("Albums", albumColumns, []interface{}{2, 1, "Green"}),
	spanner.InsertOrUpdate("Albums", albumColumns, []interface{}{2, 2, "Forever Hold Your Peace"}),
	spanner.InsertOrUpdate("Albums", albumColumns, []interface{}{2, 3, "Terrified"}),
}
View Source
var AddRecordsQuery = spanner.Statement{
	SQL: `INSERT Singers (SingerId, FirstName, LastName) VALUES
				(12, 'Melissa', 'Garcia'),
				(13, 'Russell', 'Morales'),
				(14, 'Jacqueline', 'Long'),
				(15, 'Dylan', 'Shaw')`,
}

レコードの追加(SQLの実行)

View Source
var CreateTables = []string{
	`CREATE TABLE Box (
		Id STRING(36) NOT NULL,
		Name STRING(1024) NOT NULL,
		LastName   STRING(1024),
		SingerInfo BYTES(MAX)
	) PRIMARY KEY (SingerId)`,
	`CREATE TABLE Albums (
		SingerId     INT64 NOT NULL,
		AlbumId      INT64 NOT NULL,
		AlbumTitle   STRING(MAX)
	) PRIMARY KEY (SingerId, AlbumId),
	INTERLEAVE IN PARENT Singers ON DELETE CASCADE`,
}

テーブルの作成

View Source
var ExecSQLQuery = spanner.Statement{SQL: `SELECT SingerId, AlbumId, AlbumTitle FROM Albums`}

投入データの確認(SQLの実行)

View Source
var UpdateRecords = []*spanner.Mutation{
	spanner.Update("Albums", cols, []interface{}{1, 1, 100000}),
	spanner.Update("Albums", cols, []interface{}{2, 2, 500000}),
}

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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