Skip to content
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

chore: Update Recipes for Modus 0.17.x (Go) #63

Merged
merged 2 commits into from
Jan 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions dgraph-modus-example/backend/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ module dgraph-modus-example

go 1.23.3

require github.com/hypermodeinc/modus/sdk/go v0.16.1
require github.com/hypermodeinc/modus/sdk/go v0.17.0

require (
github.com/tidwall/gjson v1.18.0 // indirect
github.com/tidwall/match v1.1.1 // indirect
github.com/tidwall/pretty v1.2.1 // indirect
github.com/tidwall/sjson v1.2.5 // indirect
)
)
8 changes: 2 additions & 6 deletions dgraph-modus-example/backend/go.sum
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
github.com/hypermodeinc/modus/sdk/go v0.15.0 h1:xRD4swlxdug4fVVKzY2FQKGUTKK2qLSDb0k/wqDDTOw=
github.com/hypermodeinc/modus/sdk/go v0.15.0/go.mod h1:Tgh2CfZztlmsAi5DAF1s2LhoARF6P61huICuuAd7hvY=
github.com/hypermodeinc/modus/sdk/go v0.16.0 h1:kO43jI1RfDgDJAEg+ilNSJIUHfsSXM2pGuHh/dT0Zec=
github.com/hypermodeinc/modus/sdk/go v0.16.0/go.mod h1:wXGlRRd/Rkxv7QwYfHzc2VoaU91lzWpiZ/zm4sTuD/U=
github.com/hypermodeinc/modus/sdk/go v0.16.1 h1:r4P9jtDI/4t0Lj/aVAezXSSfMOJ2ksuKk5xWuvQAK7g=
github.com/hypermodeinc/modus/sdk/go v0.16.1/go.mod h1:T3yLwJbP8Byf/Z6xovxP90hp8ECnpvajGdmbklW4pAk=
github.com/hypermodeinc/modus/sdk/go v0.17.0 h1:vyS82iw31xuxqQKxiVtwrSNuF6hkMEJoynlcxthAeYM=
github.com/hypermodeinc/modus/sdk/go v0.17.0/go.mod h1:UzVpTQDjloJuErOiNP3Tma3N8crE5qwYfKQyX1ecKlA=
github.com/tidwall/gjson v1.14.2/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
github.com/tidwall/gjson v1.18.0 h1:FIDeeyB800efLX89e5a8Y0BNH+LOngJyGrIWxG2FKQY=
github.com/tidwall/gjson v1.18.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
Expand Down
2 changes: 1 addition & 1 deletion modus101/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.23.1

toolchain go1.23.5

require github.com/hypermodeinc/modus/sdk/go v0.16.1
require github.com/hypermodeinc/modus/sdk/go v0.17.0

require (
github.com/tidwall/gjson v1.18.0 // indirect
Expand Down
10 changes: 2 additions & 8 deletions modus101/go.sum
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
github.com/hypermodeinc/modus/sdk/go v0.14.3 h1:7lXJvLchg2T0iT3dWwVJlua1uODVoRN5BJIEKzzZ2K8=
github.com/hypermodeinc/modus/sdk/go v0.14.3/go.mod h1:VDL2kAYHQtNEr7lxPynbchZ6HizLSSQ9cG4LrDnq3Vg=
github.com/hypermodeinc/modus/sdk/go v0.15.0 h1:xRD4swlxdug4fVVKzY2FQKGUTKK2qLSDb0k/wqDDTOw=
github.com/hypermodeinc/modus/sdk/go v0.15.0/go.mod h1:Tgh2CfZztlmsAi5DAF1s2LhoARF6P61huICuuAd7hvY=
github.com/hypermodeinc/modus/sdk/go v0.16.0 h1:kO43jI1RfDgDJAEg+ilNSJIUHfsSXM2pGuHh/dT0Zec=
github.com/hypermodeinc/modus/sdk/go v0.16.0/go.mod h1:wXGlRRd/Rkxv7QwYfHzc2VoaU91lzWpiZ/zm4sTuD/U=
github.com/hypermodeinc/modus/sdk/go v0.16.1 h1:r4P9jtDI/4t0Lj/aVAezXSSfMOJ2ksuKk5xWuvQAK7g=
github.com/hypermodeinc/modus/sdk/go v0.16.1/go.mod h1:T3yLwJbP8Byf/Z6xovxP90hp8ECnpvajGdmbklW4pAk=
github.com/hypermodeinc/modus/sdk/go v0.17.0 h1:vyS82iw31xuxqQKxiVtwrSNuF6hkMEJoynlcxthAeYM=
github.com/hypermodeinc/modus/sdk/go v0.17.0/go.mod h1:UzVpTQDjloJuErOiNP3Tma3N8crE5qwYfKQyX1ecKlA=
github.com/tidwall/gjson v1.14.2/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
github.com/tidwall/gjson v1.18.0 h1:FIDeeyB800efLX89e5a8Y0BNH+LOngJyGrIWxG2FKQY=
github.com/tidwall/gjson v1.18.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
Expand Down
8 changes: 4 additions & 4 deletions modus101/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,12 @@ func FetchQuoteAddToDB() (uint, error) {
return 0, err
}

rows, err := pg.Execute("postgres", "INSERT INTO quotes (quote, author, info) VALUES ($1, $2, $3)", quote.Quote, quote.Author, *info)
res, err := pg.Execute("postgres", "INSERT INTO quotes (quote, author, info) VALUES ($1, $2, $3)", quote.Quote, quote.Author, *info)
if err != nil {
return 0, err
}

return rows, nil
return uint(res.RowsAffected), nil
}

// Quote including author information
Expand All @@ -102,10 +102,10 @@ type DBQuote struct {

// Fetch all quotes from database
func FetchQuotesFromDB() ([]DBQuote, error) {
rows, _, err := pg.Query[DBQuote]("postgres", "SELECT quote, author, info FROM quotes")
res, err := pg.Query[DBQuote]("postgres", "SELECT quote, author, info FROM quotes")
if err != nil {
return nil, err
}

return rows, nil
return res.Rows, nil
}
Loading