Releases: steebchen/prisma-client-go
v0.9.0
v0.9.0
Go1.16 support & bugfixes
🌟 Help us spread the word about Prisma by starring the repo ☝️ or tweeting about the release.
Major changes
Go1.16 requires go.mod/go.sum to be up-to-date and that broke for generated code, as go mod tidy can't figure out what modules are needed before generating code. This is fixed by adding no-op imports in the Go client at a top-level, so they can be detected by Go modules correctly.
Changes
- fix(query): adapt default param struct name (#474) @steebchen
- docs(readme): start documenting how to test (#469) @matthewmueller
- docs(quickstart): remove --preview-feature flag (#472) @alfuhigi
- docs(quickstart): adapt code example import path (#476) @steebchen
- docs(quickstart): temporarily adapt quickstart (#481) @steebchen
- fix(prisma): upgrade to 2.22.1 patch version (#480) @steebchen
- feat(prisma): upgrade to 2.23.0 (#484) @steebchen
- fix(header): add no-op imports for go modules (#485) @steebchen
Contributors
@alfuhigi, @matthewmueller and @steebchen
Interested in providing feedback for the Go client?
We would like to ask you a few questions and get your feedback about the Go client. We'll send merch along your away as a thank you.
If you're interested, email me at [email protected] or join our public Slack and DM me.
v0.8.0
v0.8.0
Bugfixes & add AND
operator.
Upgrades to Prisma 2.22.0, making the db push
command generally available.
🌟 Help us spread the word about Prisma by starring the repo ☝️ or tweeting about the release.
Major changes
- feat(generator): add AND operator (#467) @steebchen
Changes
- feat(prisma): upgrade to 2.20.1 (#454) @steebchen
- fix(query): add arguments to unlink (#456) @steebchen
- chore(prisma): upgrade prisma & fix build constraints (#458) @steebchen
- ci(release-drafter): adapt version in tweet link (#459) @steebchen
- fix(transaction): adapt upsert & delete tx methods (#465) @steebchen
- feat(prisma): upgrade prisma to 2.22.0 (#470) @steebchen
Contributors
Interested in providing feedback for the Go client?
We would like to ask you a few questions and get your feedback about the Go client. We'll send merch along your away as a thank you.
If you're interested, email me at [email protected] or join our public Slack and DM me.
v0.7.0
v0.7.0
More native types & bugfixes
🌟 Help us spread the word about Prisma by starring the repo ☝️ or tweeting about the release.
Major changes
The Go client now supports the native types Bytes, BigInt and Decimal:
var views db.BigInt = 1
bytes := []byte("abc")
dec := decimal.NewFromFloat(1.23456789)
created, err := client.User.CreateOne(
db.User.Picture.Set(bytes),
db.User.Balance.Set(dec),
db.User.Views.Set(views),
).Exec(ctx)
Changes
- feat(client): introduce Bytes type (#443) @steebchen
- feat(client): introduce BigInt type (#444) @steebchen
- feat(client): introduce Decimal type (#445) @steebchen
- test(types): add native type test (#446) @steebchen
- chore: Create SECURITY.md (#447) @Jolg42
- fix(query): use field type for cursor value (#450) @steebchen
- fix(json): adapt internal json update handling (#451) @steebchen
Contributors
@Jolg42 and @steebchen
Interested in providing feedback for the Go client?
We would like to ask you a few questions and get your feedback about the Go client. We'll send merch along your away as a thank you.
If you're interested, email me at [email protected] or join our public Slack and DM me.
v0.6.0
v0.6.0
Apart from lots of bugfixes, this release also introduces transaction return values:
firstPost := client.Post.CreateOne(
Post.Title.Set("First Post"),
).Tx()
secondPost := client.Post.CreateOne(
Post.Title.Set("Second Post"),
).Tx()
if err := client.Prisma.Transaction(firstPost, secondPost).Exec(ctx); err != nil {
panic(err)
}
log.Printf("first post result: %+v", firstPost.Result())
log.Printf("second post result: %+v", secondPost.Result())
🌟 Help us spread the word about Prisma by starring the repo ☝️ or tweeting about the release.
Breaking changes
When using transactions, you need to explicitly call .Tx() in each operation.
before:
firstPost := client.Post.CreateOne(
Post.Title.Set("First Post"),
)
secondPost := client.Post.CreateOne(
Post.Title.Set("Second Post"),
)
if err := client.Prisma.Transaction(firstPost, secondPost).Exec(ctx); err != nil {
panic(err)
}
after:
firstPost := client.Post.CreateOne(
Post.Title.Set("First Post"),
).Tx()
secondPost := client.Post.CreateOne(
Post.Title.Set("Second Post"),
).Tx()
if err := client.Prisma.Transaction(firstPost, secondPost).Exec(ctx); err != nil {
panic(err)
}
Major changes
- feat(transactions): add tx return values (#424) @steebchen
Changes
- fix(query): use AND queries to allow duplicate fields (#429) @steebchen
- fix(query): adapt postgres array query type (#430) @steebchen
- ci(release-drafter): adapt version in tweet link (#423) @steebchen
- fix(engine): set http timeout to 0 (#431) @steebchen
- fix(query): fix nil slices for pg array types (#432) @steebchen
- docs(transaction): adapt transaction syntax (#435) @steebchen
- fix(transaction): add
Into(interface{})
method for QueryRaw (#438) @steebchen - docs(reference): improve transaction examples (#436) @matthewmueller
- fix(transaction): introduce result method (#441) @steebchen
Contributors
@matthewmueller and @steebchen
Extra thanks to @robojones for the help with transaction syntax!
Interested in providing feedback for the Go client?
We would like to ask you a few questions and get your feedback about the Go client. We'll send merch along your away as a thank you.
If you're interested, email me at [email protected] or join our public Slack and DM me.
v0.5.0
v0.5.0
Tons of bugfixes & Upsert!
🌟 Help us spread the word about Prisma by starring the repo ☝️ or tweeting about the release.
Major changes
UpsertOne
post, err := client.Post.UpsertOne(
// query
Post.ID.Equals("upsert"),
).Create(
// set these fields if document doesn't exist already
Post.Title.Set("title"),
Post.Views.Set(0),
Post.ID.Set("upsert"),
).Update(
// update these fields if document already exists
Post.Title.Set("new-title"),
Post.Views.Increment(1),
).Exec(ctx)
if err != nil {
panic(err)
}
Changes
- fix(unique): use new uniqueFields model data (#391) @steebchen
- ci(lint): increase timeout to 5m (#394) @steebchen
- feat(raw): handle time values (#393) @steebchen
- feat(transaction): support raw queries in transaction (#398) @steebchen
- fix(fetch): allow fetching with update/delete (#400) @steebchen
- docs: fix broken/missing links & example code (#403) @imkh
- feat(generate): write debug file on env var (#404) @steebchen
- feat(indexes): support composite id indexes, restructure templates (#405) @steebchen
- fix(engine): remove debug logs (#412) @steebchen
- fix(query): allow empty links to use with IfPresent (#413) @steebchen
- fix: add dummy.go files to template dirs (#416) @bshihr
- feat(upsert): add upsert (#415) @steebchen
- docs(upsert): add docs for UpsertOne (#417) @steebchen
- feat(prisma): upgrade to 2.17.0 (#421) @steebchen
- feat(prisma): upgrade to 2.18.0 (#422) @steebchen
Contributors
@bshihr, @imkh and @steebchen
Interested in providing feedback for the Go client?
We would like to ask you a few questions and get your feedback about the Go client. We'll send merch along your away as a thank you.
If you're interested, email me at [email protected] or join our public Slack and DM me.
v0.4.1
v0.4.1
A patch release for [email protected].
This fixes some connectivity issues with MySQL/SQL Server.
🌟 Help us spread the word about Prisma by starring the repo ☝️ or tweeting about the release.
Changes
- feat(prisma): upgrade prisma to 2.16.1 patch release (#392) @steebchen
Contributors
Interested in providing feedback for the Go client?
We would like to ask you a few questions and get your feedback about the Go client. We'll send merch along your away as a thank you.
If you're interested, email me at [email protected] or join our public Slack and DM me.
v0.4.0
v0.4.0
Dynamically build queries, helper methods, some BREAKING CHANGES (see below)
🌟 Help us spread the word about Prisma by starring the repo ☝️ or tweeting about the release.
Major changes
Dynamically build queries
Give your users more control over how they filter and order their data. Build up filters over time instead of all at once.
Here's an example of setting specific attributes dynamically:
func CreateUser(w http.ResponseWriter, r *http.Request) {
var params []db.UserSetParam
email := r.PostFormValue("email")
kind := r.PostFormValue("kind")
if kind == "customer" {
// Set the referrer for users of type customer only
params = append(params, db.User.Referer.Set(r.Header.Get("Referer"))
}
user, err := client.User.CreateOne(
db.User.Kind.Set(kind),
db.User.Email.Set(email),
params...,
).Exec(r.Context())
// ... Handle the response
}
Learn more in the dynamic queries document.
ExecInner helper method
Prisma uses a specific structure for its models. For some libraries, you might need a struct with pointer values instead of Prisma’s embedded structure.
For this case, you can use the .InnerX embedded structs to get the plain object. However, there was no method for results with slices before, so we introduced ExecInner:
users, err := client.User.FindMany().ExecInner(ctx)
doSomething(users)
Breaking changes
All methods returning structs now return a pointer to a struct
Methods in shape of (T, error) now return (*T, error):
user, err := client.User.FindMany().Exec(ctx)
// user was of type db.UserModel
// user is now of type *db.UserModel
log.Printf(“user: %+v”, *user)
Methods returning a primitive value such as count now returns struct
For more consistency, all methods which used to return a count-like value now return a pointer to a struct.
result, err := client.User.FindMany().Update(…).Exec(ctx)
// result was of type int before
// result is now a pointer to a struct
log.Printf(“user: %d”, result.Count)
This affects the following methods:
client.X.FindMany().Update().Exec(ctx)
client.X.FindMany().Delete().Exec(ctx)
client.ExecuteRaw(…).Exec(ctx)
Embedded model structs InternalX are renamed to InnerX
Internal might be misleading as it’s recommended to use the top-level return value wherever possible, but with some libraries you might need to use the embedded struct, so we renamed it to Inner to make it more clear what it does.
user, err := client.User.FindUnique()
// was called user.InternalUser before
// now is called user.InnerUser
doSomething(user.InnerUser)
Changes
- ci(test): remove verbose logs (#375) @steebchen
- fix(templates): rename internal->inner (#376) @steebchen
- feat(query): add ExecInner for find queries (#373) @steebchen
- fix(create): accept interface in CreateOne (#378) @steebchen
- fix(tests): throttle test setup schema generation (#379) @steebchen
- feat(client): export builder interfaces (#380) @steebchen
- feat(client): introduce result struct, use pointers (#381) @steebchen
- docs(reference): add dynamic queries docs (#383) @steebchen
- feat(prisma): upgrade to 2.16.0; adapt dmmf, publish & tests (#384) @steebchen
- ci(release-drafter): use minor version in template (#385) @steebchen
- fix(types): define count result in types (#386) @steebchen
- fix(types): rename count result to BatchResult (#387) @steebchen
- fix(raw): change int return value to BatchResult (#388) @steebchen
Contributors
Interested in providing feedback for the Go client?
We would like to ask you a few questions and get your feedback about the Go client. We'll send merch along your away as a thank you.
If you're interested, email me at [email protected] or join our public Slack and DM me.
v0.3.0
v0.3.0
- Introduces basic transactions
- Introduces
FindFirst
FindOne
is deprecated in favour ofFindUnique
- There's also a new
Prisma
namespace for Prisma-related functions.
🌟 Help us spread the word about Prisma by starring the repo ☝️ or tweeting about the release.
Major changes
Introducing transactions: run multiple statements at once, guaranteeing that everything as a whole either fails or succeeds.
createUserA := client.User.CreateOne(
User.Email.Set("a"),
User.ID.Set("a"),
)
createUserB := client.User.CreateOne(
User.Email.Set("b"),
User.ID.Set("b"),
)
if err := client.Prisma.Transaction(createUserA, createUserB).Exec(ctx); err != nil {
panic(err)
}
FindOne is deprecated. It's renamed to FindUnique.
To find a record which is not guaranteed to be unique, you can now use the new FindFirst method to use the first element which is found:
post, err := client.Post.FindFirst(
db.Post.Title.Equals("hi"),
).Exec(ctx)
if errors.Is(err, db.ErrNotFound) {
log.Printf("no record with title 'hi' found")
} else if err != nil {
log.Printf("error occurred: %s", err)
}
log.Printf("post: %+v", post)
All Prisma-related functions on the prisma client object are deprecated in favour of a new prisma namespace.
The following methods:
client := prisma.NewClient()
client.Connect(…)
client.Disconnect(…)
client.ExecuteRaw(…)
client.QueryRaw(…)
Should be used as follows:
client := prisma.NewClient()
client.Prisma.Connect(…)
client.Prisma.Disconnect(…)
client.Prisma.ExecuteRaw(…)
client.Prisma.QueryRaw(…)
Changes
- fix(binaries): add hash to engine path (#338) @steebchen
- feat(prisma): upgrade to 2.12.0 (#339) @steebchen
- ci(publish): specify node targets explicitly; cleanup (#341) @steebchen
- feat(query): add FindFirst method (#352) @steebchen
- chore(prisma): upgrade prisma to 2.14.0 (#354) @steebchen
- fix(query): deprecate FindOne, replace with FindUnique (#353) @steebchen
- fix(query): adapt non-find queries for new find calls (#355) @steebchen
- fix(query): disallow additional methods on FindFirst (#356) @steebchen
- docs(reference): add FindFirst paragraph; adapt FindUnique (#358) @steebchen
- refactor(generator): return -1 on raw error; minor code cleanup (#359) @steebchen
- feat(client): introduce prisma client namespace (#360) @steebchen
- refactor(project): extract packages into runtime folder (#361) @steebchen
- feat(client): add transactions (#336) @steebchen
- docs(transaction): add transaction docs (#362) @steebchen
- docs(quickstart): use prisma folder for schema path (#335) @steebchen
- docs(reference): cleanup schemas & examples (#366) @steebchen
- chore(binaries): upgrade prisma to 2.15.0 (#368) @steebchen
- fix(find): make sure FindOne deprecation comment works (#367) @steebchen
- docs(reference): adapt FindFirst example (#369) @steebchen
- docs(reference): adapt error checking in find examples (#370) @steebchen
Contributors
Interested in providing feedback for the Go client?
We would like to ask you a few questions and get your feedback about the Go client. We'll send merch along your away as a thank you.
If you're interested, email me at [email protected] or join our public Slack and DM me.
v0.2.0
v0.2.0
JSON support, native mocks, helper methods & minor improvements
🌟 Help us spread the word about Prisma by starring the repo ☝️ or tweeting about the release.
Major changes
- feat(prisma): upgrade prisma to 2.11.0 (#301) @steebchen
- feat(types): add basic json support (#310) @steebchen
- feat(query): introduce
IfPresent
method variants (#300) @steebchen - feat(mocks): add native mocking (#315) @steebchen
Changes
- chore(dockerignore): use globs correctly (#293) @steebchen
- refactor(project): move err checks to if clauses (#305) @steebchen
- chore(project): format prisma schema files (#306) @steebchen
- fix(builder): remove manual date time serialisation (#311) @steebchen
- test(setup): bump mysql version, use fixed pg image (#312) @steebchen
- ci(workflows): remove rebase command (#313) @steebchen
- refactor(generator): use universal graphql result (#314) @steebchen
- fix(test): disable migrate logs per default (#316) @steebchen
- chore(test): use db push instead of migrate (#307) @steebchen
- docs(json): add json docs (#320) @steebchen
- ci(github): ignore docs changes in GitHub actions (#321) @steebchen
- chore(jetbrains): add shared .idea config (#325) @steebchen
- chore(jetbrains): remove watcher tasks file (#327) @steebchen
- ci(github): revert ignoring docs folder (#323) @steebchen
- chore(idea): set git toolbox commit message validation (#329) @steebchen
- docs(reference): document optional type filters (#328) @steebchen
- docs(reference): document XIfPresent method variants (#330) @steebchen
- test(mocks): rename prisma client variable (#331) @steebchen
- docs(reference): document mock usage and example (#332) @steebchen
- refactor(engine): simplify internal engine (#333) @steebchen
- refactor(builder): extract exec method (#334) @steebchen
Contributors
Interested in providing feedback for the Go client?
We would like to ask you a few questions and get your feedback about the Go client. We'll send merch along your away as a thank you.
If you're interested, email me at [email protected] or join our public Slack and DM me.
v0.1.0
v0.1.0
Go client early access
The Go client is now an early access product and is not considered experimental anymore. 🎉
This means we will continue to invest in the Go client, but at the same time those resourced will be limited and we may have breaking changes in minor releases.
Release Notes
This release contains minor improvements and bumps the internal Prisma CLI to 2.10.2.
🌟 Help us spread the word about Prisma by starring the repo ☝️ or tweeting about the release.
Major changes
- bump internal Prisma CLI to 2.10.2 (#290, #291)
- improve docs (#284)
- fix
.Link()
method parameters (#288)
Changes
- fix(errors): refactor internal pql error handling (#279) @steebchen
- fix(raw): adapt result struct (#281) @steebchen
- test(raw): test insert into raw statements (#280) @steebchen
- test(raw): add tests for update (#283) @steebchen
- docs(raw): clarify raw methods (#282) @steebchen
- feat(docs): refactor docs; add pagination & order by (#284) @steebchen
- fix(query): link many relations in nested create/update (#288) @steebchen
- feat(prisma): upgrade to 2.10.1 (#290) @steebchen
- feat(prisma): bump to 2.10.2 (#291) @steebchen
- ci(workflows): add rebase command (#292) @steebchen
- chore(project): minor code improvements & linter fixes (#295) @steebchen
- ci(release-drafter): switch to minor versions (#296) @steebchen
- docs(readme): change alpha mention to EAP (#297) @steebchen
Contributors
Interested in providing feedback for the Go client?
We would like to ask you a few questions and get your feedback about the Go client. We'll send merch along your away as a thank you.
If you're interested, email me at [email protected], join our public Slack, or schedule a call directly with us.