-
Notifications
You must be signed in to change notification settings - Fork 0
Money module Tigerbeetle connection #12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
6df23bc
85a34b8
02d587c
4021378
d28e403
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,5 @@ | ||
| module money-module | ||
|
|
||
| go 1.22.2 | ||
|
|
||
| require github.com/tigerbeetle/tigerbeetle-go v0.17.1 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| github.com/tigerbeetle/tigerbeetle-go v0.17.1 h1:jrpTigDx/UN7+xAlV14H6er6AUR+CstYALjZZATJtJc= | ||
| github.com/tigerbeetle/tigerbeetle-go v0.17.1/go.mod h1:d6G7n4OlD7GLHd62x0VlWPXeI/L0SoNNTfm/ee24GJI= |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,25 @@ | ||
| package main | ||
|
|
||
| import "fmt" | ||
| import ( | ||
| "log" | ||
| "os" | ||
|
|
||
| tb "github.com/tigerbeetle/tigerbeetle-go" | ||
| ) | ||
|
|
||
| func main() { | ||
| fmt.Println("Hello, World!") | ||
| tbAddress := os.Getenv("TIGERBEETLE_ADDRESS") | ||
|
|
||
| if len(tbAddress) == 0 { | ||
| tbAddress = "3000" | ||
| } | ||
|
|
||
| client, err := tb.NewClient(tb.ToUint128(0), []string{tbAddress}) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: Is there a way to use var client tb.Client, var err error. (Maybe just declare on line above?) (TiGoStyle shit). I think this is fine in this case because this statement cannot be misinfered and will be hidden in the init anyways |
||
|
|
||
| if err != nil { | ||
| log.Printf("Error creating client: %s", err) | ||
| return | ||
| } | ||
|
|
||
| defer client.Close() | ||
| } | ||
|
Comment on lines
1
to
25
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we move these to an init and fini functions please. |
||
This file was deleted.
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(TiGoStyle) I think this is something we should fully check our preconditions for. (i.e I think money-module should instantly fail if the address isn't numeric, and nor a valid port number etc (TiGoStyle))