This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| INSERT INTO person | |
| (name, country, job, age) | |
| values ('Mike', 'England', 'Software Engineer', 30) | |
| ON CONFLICT (name) | |
| DO NOTHING; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| INSERT INTO person | |
| (name, country, job, age) | |
| values ('Danny', 'England', 'Software Engineer', 30) | |
| ON CONFLICT ON CONSTRAINT person_name_unique | |
| DO NOTHING; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| INSERT INTO person | |
| (name, country, job, age) | |
| values ('Danny', 'England', 'Software Engineer', 30) | |
| ON CONFLICT (name) | |
| DO NOTHING; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| INSERT INTO person | |
| ("name", country, job, age) | |
| values | |
| ('Danny', 'England', 'Software Engineer', 30), | |
| ('Peter', 'Egypt', 'Front End Engineer', 32); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ALTER TABLE person | |
| ADD CONSTRAINT person_name_unique UNIQUE ("name"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| CREATE TABLE person ( | |
| id bigserial NOT NULL, | |
| name varchar NOT NULL, | |
| country varchar NOT NULL, | |
| job varchar NOT NULL, | |
| age int NOT NULL | |
| ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "context" | |
| "encoding/json" | |
| "fmt" | |
| "log" | |
| "google.golang.org/api/option" | |
| "google.golang.org/api/sheets/v4" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| func GetCellValue(srv *sheets.Service) { | |
| values, err := srv.Spreadsheets.Values.Get(spreadsheetId, "Sheet1!A2:E7").Do() | |
| if err != nil { | |
| log.Fatalf("Unable to Get data from sheet: %v", err) | |
| } | |
| for _, value := range values.Values { | |
| fmt.Println(value) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| func ClearColumn(srv *sheets.Service) { | |
| cvr := sheets.ClearValuesRequest{} | |
| _, err := srv.Spreadsheets.Values.Clear(spreadsheetId, "Sheet1!C2:C", &cvr).Do() | |
| if err != nil { | |
| log.Fatalf("Unable to clear data from sheet: %v", err) | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| func ClearCell(srv *sheets.Service) { | |
| cvr := &sheets.ClearValuesRequest{} | |
| _, err := srv.Spreadsheets.Values.Clear(spreadsheetId, "Sheet1!B2", cvr).Do() | |
| if err != nil { | |
| log.Fatalf("Unable to clear data from sheet: %v", err) | |
| } | |
| } |