Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Adarsh-jaiss committed May 17, 2024
2 parents 8710080 + 6145fc0 commit cdd4ccf
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
14 changes: 8 additions & 6 deletions example/redshift/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,23 @@ import (
"database/sql"
"fmt"

"github.com/thesaas-company/xray"
"github.com/thesaas-company/xray/config"
"github.com/thesaas-company/xray/databases/redshift"
"github.com/thesaas-company/xray/types"
)

func main() {
// Define the configuration for the Redshift instance
cfg := &config.Config{
Region: "my-region-us-west-2",
AccountID: "123456789012",
SecretName: "my-secret",
Host: "default-workgroup.609973658768.ap-south-1.redshift-serverless.amazonaws.com",
DatabaseName: "dev",
Username: "admin",
Port: "5439",
SSL: "require",
}

// Create a new Redshift instance
rs, err := redshift.NewRedshiftWithConfig(cfg)
rs, err := xray.NewClientWithConfig(cfg,types.Redshift)
if err != nil {
fmt.Printf("Error creating Redshift instance: %v\n", err)
return
Expand Down Expand Up @@ -54,7 +56,7 @@ func main() {
res := rs.GenerateCreateTableQuery(table)
fmt.Println(res)

query := "SELECT * FROM my_table"
query := "SELECT * FROM sales limit 10"
result, err := rs.Execute(query)
if err != nil {
fmt.Printf("Error executing query: %v\n", err)
Expand Down
1 change: 1 addition & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,7 @@ github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0
github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw=
github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=

github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8=
github.com/mtibben/percent v0.2.1 h1:5gssi8Nqo8QU/r2pynCm+hBQHpkB/uNK7BJCFogWdzs=
github.com/mtibben/percent v0.2.1/go.mod h1:KG9uO+SZkUp+VkRHsCdYQV3XSZrrSpR3O9ibNBTZrns=
Expand Down

0 comments on commit cdd4ccf

Please sign in to comment.