A self-contained pattern for giving each tenant its own independent incrementing
block_number, without global sequences, using an atomic upsert counter table
and a BEFORE INSERT trigger.
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 ( | |
| "bytes" | |
| "context" | |
| "fmt" | |
| "io/ioutil" | |
| "log" | |
| "os" | |
| "path" |
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 OR REPLACE FUNCTION public.null_or_not_uuid(str text) | |
| RETURNS text | |
| LANGUAGE plpgsql | |
| AS $function$ | |
| declare | |
| struuid uuid; | |
| begin | |
| struuid = str::uuid; | |
| RETURN null; | |
| EXCEPTION WHEN invalid_text_representation THEN |
I hereby claim:
- I am arxdsilva on github.
- I am arxdsilva (https://keybase.io/arxdsilva) on keybase.
- I have a public key ASCzXbVUKxXNY62FR-O9gUY7YH4LxVEkHEU5VHtZ1pGnTAo
To claim this, I am signing this object:
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" | |
| "database/sql" | |
| "encoding/json" | |
| "github.com/heroiclabs/nakama-common/runtime" | |
| ) | |
| // InitModule registers the RPC function into the game server |
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 ( | |
| "fmt" | |
| ) | |
| type A struct { | |
| Name string | |
| Age string | |
| } |
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 | |
| // playground | |
| // https://play.golang.org/p/dPmHZkw2QwB | |
| import ( | |
| "fmt" | |
| "encoding/json" | |
| ) |
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 | |
| // info https://play.golang.org/p/uAWpm-rUc-1 | |
| import ( | |
| "fmt" | |
| "strings" | |
| ) | |
| func main() { | |
| s := strings.Replace("nextpdf5,00reais_1564141286.pdf", ",", "", -1) | |
| fmt.Println(s) |
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 | |
| // https://play.golang.org/p/utIG70ublyv | |
| import ( | |
| b64 "encoding/base64" | |
| "fmt" | |
| ) | |
| func main() { |
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 ( | |
| "fmt" | |
| "io/ioutil" | |
| "net/http" | |
| "time" | |
| ) | |
| func main() { |
NewerOlder