Prisma Client Go is an auto-generated and fully type-safe database client


Prisma Client Go

Typesafe database access for Go

Quickstart   •   Website   •   Docs   •   API reference   •   Blog   •   Slack   •   Twitter

Prisma Client Go is an auto-generated query builder that enables type-safe database access and reduces boilerplate. You can use it as an alternative to traditional ORMs such as gorm, xorm, sqlboiler and most database-specific tools.

It is part of the Prisma ecosystem. Prisma provides database tools for data access, declarative data modeling, schema migrations and visual data management.

NOTE: Prisma Client Go is currently offered under our early access program. There will be documented breaking changes with new releases.

Getting started

To get started, read our quickstart tutorial to add Prisma to your project in just a few minutes.

You also might want to read deployment tips and the full API reference.

Notes

The go client works slightly different than the normal Prisma tooling. When you're using the go client, whenever you see Prisma CLI commands such as prisma ..., you should always write go run github.com/prisma/prisma-client-go ... instead.

Contributing

We use conventional commits (also known as semantic commits) to ensure consistent and descriptive commit messages.

Security

If you have a security issue to report, please contact us at [email protected]

Owner
Prisma
Prisma makes working with databases easy
Prisma
Comments
  • How to improve Timeout problems?

    How to improve Timeout problems?

    I keep getting a very very slow start whenever my server restarts or is redeployed. It used to be quick, but it takes too long these days and I worry!

    {
      "errors": [
        {
          "message": "could not find tracking information for order: Request failed: raw post: Post \"http://localhost:58197/\": context deadline exceeded (Client.Timeout exceeded while awaiting headers)",
          "path": [
            "trackOrder"
          ]
        }
      ],
      "data": null
    }
    
  • Reduce code verbosity for conditional filters

    Reduce code verbosity for conditional filters

    Currently for database filters require to pass an actual integer value for filtering:

    
    var upperBound int
    
    users, err := r.Client.User.FindMany(
       db.User.NumPosts.GT(upperBound),
    ).Exec(ctx)
    

    When offering a variety of filtering options via an API, the user might or might not set certain filter options (equals, gt, gte, lt, lte, .... ). These filter options are then nil in golang.

    Currently I have to check all possible combinations of filter options and write the corresponding query to my database which leads to huge repeated code.

    tl;dr: Can we please have nullable filters where we can just do:

    var equalsParam *int
    var gtParam *int
    var gteParam *int
    var ltParam *int
    var lteParam *int
    
    users, err := r.Client.User.FindMany(
       db.User.NumPosts.Equals(equalsParam),
       db.User.NumPosts.GT(gtParam),
       db.User.NumPosts.GTE(gteParam),
       db.User.NumPosts.LT(ltParam),
       db.User.NumPosts.LTE(lteParam),
      ...
    ).Exec(ctx)
    

    nil ops could just be ignored and the query could throw an error when an impossible combination of operations is used.

    The same might be useful for String and Float filters.

  • Set intersect query with []string and .In()

    Set intersect query with []string and .In()

    I'm working with a model that includes a tags []string kind of thing, and I'd like to know if it's possible to do some specific intersections for queries.

    For reference, the feature I'm working on is open source so it may help to check the PR: https://github.com/openmultiplayer/web/pull/420/files

    The relevant part of the schema is here: https://github.com/openmultiplayer/web/blob/forum-categories/prisma/schema.prisma#L94-L128 notably the list of Tags in each Post model.

    It works great with these queries: https://github.com/openmultiplayer/web/pull/420/files#diff-3c9c79132aaec9a342a9567721f83d4d8b968069440955ebdbf80e89bd31b1b1R155-R183 if you specify one or many tags in the arguments, you get any post that has any of the specified tags.

    So, let's say I have 3 posts

    1. tagged "Food"
    2. tagged "Music"
    3. tagged "Food" and "Music"

    When I query "food,music" I get post 1 and 2 but not post 3

    When I query "food" I get post 1 but not post 3

    When I query "music" I get post 2 but not post 3

    So it seems posts with multiple tags cannot be queried with my approach.

    Is there a good way of doing this with the current Go API? Or do I have to go to raw SQL for this.

    Thanks!

  • Build ARM compatible CLI binaries

    Build ARM compatible CLI binaries

    I've recently switched to an M1 mac and the currently binaries provided are not compatible with this chipset.

    I do not know of the best solution for this as GitHub does not yet provide runners (https://github.com/actions/virtual-environments/issues/2187) so cross compilation is probably the only real possibility unless someone on the Prisma team would be willing to compile and publish the binaries themselves.

    From having a look at the pkg README it sounds like it should be possible with something like the following command however I have not tested it.

    npx pkg -t node17-darwin-arm64 --no-bytecode --public-packages "*" --public node_modules/prisma
    

    This is relevant for Prisma Client Python as there is work being done to support ARM compiled engines: https://github.com/RobertCraigie/prisma-client-py/pull/233

  • Return multiple things at once

    Return multiple things at once

    Assuming we have the following datamodel:

    model Post {
      id     ID      @id
      title  String
      author User
    }
    
    model User {
      id    ID     @id
      name  String
      posts Post[]
    }
    

    The goal is to fetch multiple things at once, e.g. a user with his posts. The main problem is that Go can't return more struct fields dynamically, but we still want a (mostly) type safe solution.

    My proposal:

    Photon generates structs with all relations:

    type User struct {
      ID    string
      Name  string
      Posts []Post
    }
    

    Fetch just a user:

    user, err := photon.User.FindOne.Where(
      photon.User.Email.Equals("[email protected]"),
    ).Exec(ctx)
    
    // user.Posts == nil
    // len(user.Posts) == 0
    

    Fetch a user and their posts:

    user, err := photon.User.FindOne.Where(
      photon.User.Email.Equals("[email protected]"),
    ).With(
      photon.User.Posts.Limit(10),
    ).Exec(ctx)
    
    // user.Posts will contain the user's posts with a limit of 10
    

    Thanks to @robojones for the .With(...) syntax idea.

    Feedback or other approaches (even if they're completely different) are very welcome!

  • request failed: raw post: Post

    request failed: raw post: Post "/": unsupported protocol scheme ""

    I'm having this error with github.com/prisma/prisma-client-go v0.9.0

    Here are my logs:

    debug: 2021/06/08 18:39:48 temp dir: /var/folders/7c/87mt5r7x74g7hndhbw1zd8tw0000gn/T/
    debug: 2021/06/08 18:39:48 unpacked at /var/folders/7c/87mt5r7x74g7hndhbw1zd8tw0000gn/T/prisma/binaries/engines/adf5e8cba3daf12d456d911d72b6e9418681b28b/unpacked/prisma-query-engine-darwin in 75.200538ms
    debug: 2021/06/08 18:39:48 ensure query engine binary...
    debug: 2021/06/08 18:39:48 temp dir: /var/folders/7c/87mt5r7x74g7hndhbw1zd8tw0000gn/T/
    debug: 2021/06/08 18:39:48 expecting local query engine `prisma-query-engine-darwin` or `prisma-query-engine-darwin`
    debug: 2021/06/08 18:39:48 expecting global query engine `/var/folders/7c/87mt5r7x74g7hndhbw1zd8tw0000gn/T/prisma/binaries/engines/adf5e8cba3daf12d456d911d72b6e9418681b28b/unpacked/prisma-query-engine-darwin` or `/var/folders/7c/87mt5r7x74g7hndhbw1zd8tw0000gn/T/prisma/binaries/engines/adf5e8cba3daf12d456d911d72b6e9418681b28b/unpacked/prisma-query-engine-darwin`
    debug: 2021/06/08 18:39:48 query engine found in global path
    debug: 2021/06/08 18:39:49 version check took 515.9406ms
    debug: 2021/06/08 18:39:49 using query engine at /var/folders/7c/87mt5r7x74g7hndhbw1zd8tw0000gn/T/prisma/binaries/engines/adf5e8cba3daf12d456d911d72b6e9418681b28b/unpacked/prisma-query-engine-darwin
    debug: 2021/06/08 18:39:49 ensure query engine took 516.078382ms
    debug: 2021/06/08 18:39:49 running query-engine on port 59575
    debug: 2021/06/08 18:39:49 starting engine...
    debug: 2021/06/08 18:39:49 connecting to engine...
    debug: 2021/06/08 18:39:49 prisma engine payload: `{}`
    debug: 2021/06/08 18:39:49 could not connect; retrying...
    {"timestamp":"Jun 08 18:39:49.377","level":"INFO","fields":{"message":"Starting a postgresql pool with 13 connections."},"target":"quaint::pooled","span":{"features":"[]","url":"\"postgres://[email protected]:5432/REDACTED\"","name":"exec_loader"},"spans":[{"name":"listen"},{"features":"[]","url":"\"postgres://[email protected]:5432/REDACTED\"","name":"exec_loader"}]}
    debug: 2021/06/08 18:39:49 prisma engine payload: `{}`
    debug: 2021/06/08 18:39:49 could not connect; retrying...
    debug: 2021/06/08 18:39:49 prisma engine payload: `{}`
    debug: 2021/06/08 18:39:49 could not connect; retrying...
    debug: 2021/06/08 18:39:49 prisma engine payload: `{}`
    debug: 2021/06/08 18:39:49 could not connect; retrying...
    debug: 2021/06/08 18:39:49 prisma engine payload: `{}`
    debug: 2021/06/08 18:39:49 could not connect; retrying...
    debug: 2021/06/08 18:39:49 prisma engine payload: `{}`
    debug: 2021/06/08 18:39:49 could not connect; retrying...
    debug: 2021/06/08 18:39:49 prisma engine payload: `{}`
    debug: 2021/06/08 18:39:49 could not connect; retrying...
    debug: 2021/06/08 18:39:50 prisma engine payload: `{}`
    debug: 2021/06/08 18:39:50 could not connect; retrying...
    debug: 2021/06/08 18:39:50 prisma engine payload: `{}`
    debug: 2021/06/08 18:39:50 could not connect; retrying...
    debug: 2021/06/08 18:39:50 prisma engine payload: `{}`
    debug: 2021/06/08 18:39:50 could not connect; retrying...
    debug: 2021/06/08 18:39:50 prisma engine payload: `{}`
    debug: 2021/06/08 18:39:50 could not connect; retrying...
    debug: 2021/06/08 18:39:50 prisma engine payload: `{}`
    debug: 2021/06/08 18:39:50 could not connect; retrying...
    debug: 2021/06/08 18:39:50 prisma engine payload: `{}`
    debug: 2021/06/08 18:39:50 could not connect; retrying...
    debug: 2021/06/08 18:39:50 prisma engine payload: `{}`
    debug: 2021/06/08 18:39:50 could not connect; retrying...
    debug: 2021/06/08 18:39:50 prisma engine payload: `{}`
    debug: 2021/06/08 18:39:50 could not connect; retrying...
    debug: 2021/06/08 18:39:50 prisma engine payload: `{}`
    debug: 2021/06/08 18:39:50 could not connect; retrying...
    debug: 2021/06/08 18:39:51 prisma engine payload: `{}`
    debug: 2021/06/08 18:39:51 could not connect; retrying...
    debug: 2021/06/08 18:39:51 prisma engine payload: `{}`
    debug: 2021/06/08 18:39:51 could not connect; retrying...
    {"timestamp":"Jun 08 18:39:51.164","level":"INFO","fields":{"message":"Started http server on http://127.0.0.1:59575"},"target":"query_engine::server","span":{"name":"listen"},"spans":[{"name":"listen"}]}
    debug: 2021/06/08 18:39:51 prisma engine payload: `{}`
    debug: 2021/06/08 18:39:51 [timing] query engine raw request took 2.983126ms
    debug: 2021/06/08 18:39:51 [timing] elapsed: 97µs
    debug: 2021/06/08 18:39:51 [timing] just http: 2.886126ms
    debug: 2021/06/08 18:39:51 [timing] http percentage: 96.75%
    debug: 2021/06/08 18:39:51 connecting took 2.411555421s
    debug: 2021/06/08 18:39:51 connected.
    debug: 2021/06/08 18:39:51 disconnecting...
    debug: 2021/06/08 18:39:51 disconnected.
    
    

    Making a query results in the following error:

    debug: 2021/06/08 18:18:22 [timing] building "44.26µs"
    debug: 2021/06/08 18:18:22 prisma engine payload: `{"query":"query {result: findFirstUser(where:{AND:[{emailAddress:{equals:\"[email protected]\",}},{role:{equals:\"PATIENT\",}},],},) {id createdAt role firstName lastName accessToken password emailAddress metadata phoneNumber updatedAt }}","variables":{}}`
    debug: 2021/06/08 18:18:22 [timing] TOTAL "143.224µs"
    
    
    ERRO[0024] Error querying email [email protected] due to request failed: raw post: Post "/": unsupported protocol scheme ""
    

    Project Structure (-if that helps)


    main.go

    package main 
    
    import (
    "com.coolestapp/intheplanet/prisma/db"
    // A bunch of stuff
    )
    // Starts DB Connection for Prisma Engine
    func init() {
    	prismaClient := db.NewClient()
    	if err := prismaClient.Prisma.Connect(); err != nil {
    		panic(err)
    	}
    
    	defer func() {
    		if err := prismaClient.Prisma.Disconnect(); err != nil {
    			panic(err)
    		}
    	}()
    }
    
    func main() {
    	conf := configs.ApplicationConfig()
    
    	app := fiber.New(conf)
    
    	app.Use(pprof.New())
    
            // Other unimportant stuff
    
    	utils.StartServer(app) // Starts my server
    }
    
    

    controllers/users.go - where I'm actually making the query

    // imports and everything
    
    var prismaClient = db.NewClient()
    var ctx = context.Background()
    
    // More funcs
    
    func GetPatientByEmail(c *fiber.Ctx) error {
    
    	emailInfo := &patient.PatientByEmailQuery{}
    
    	if err := c.BodyParser(emailInfo); err != nil {
    		return c.Status(fiber.StatusBadRequest).JSON(fiber.Map{
    			"error":   true,
    			"message": err.Error(),
    		})
    	}
    
    	patient, err := prismaClient.User.FindFirst(
    		db.User.EmailAddress.Equals(emailInfo.EmailAddress),
    		db.User.Role.Equals(db.ROLEPATIENT),
    	).Exec(ctx)
    	if err != nil {
    		logger.Errorf("Error querying email %s due to %v", emailInfo.EmailAddress, err)
    		return c.Status(fiber.StatusInternalServerError).JSON(fiber.Map{
    			"errror":  true,
    			"message": err.Error(),
    		})
    	}
    	return c.JSON(fiber.Map{
    		"error":   false,
    		"message": nil,
    		"patient": patient,
    	})
    }
    

    I had deleted the prisma folder as mentioned in https://github.com/prisma/prisma-client-go/issues/448#issuecomment-808409412 and run generate afterwards

  • request failed: raw post

    request failed: raw post

    Trying to execute a createOne:

    request failed: raw post: Post "http://localhost:38321/": dial tcp 127.0.0.1:38321: connect: connection refused
    

    My code:

    _, err := m.store.dbClient.PonosJob.CreateOne(
    		db.PonosJob.ID.Set([]byte(job.ID)),
    		db.PonosJob.Payload.Set(job.Payload),
    		db.PonosJob.Queue.Link(db.PonosJobQueue.ID.Equals([]byte(job.QueueID))),
    		db.PonosJob.ScheduledAt.Set(time.Now()),
    		db.PonosJob.CreatedAt.Set(time.Now()),
    	).Exec(m.store.ctx)
    

    Let me know if you need anything else

  • Setting db provider url at runtime

    Setting db provider url at runtime

    First, thank you for all of your help!

    I am trying to understand the best way to integrate prisma into my project. Right now I have a separate repo with the schema and built clients. This allows different services to import the clients (typescript/golang). One thing I cant figure out is if it is possible to set the provider url at runtime. So I can switch between dev/prod envs. Is this possible and a reasonable approach? Or should I generate a new client from the schema for each package/env?

  • The method updateOne returns FieldNotFoundError.

    The method updateOne returns FieldNotFoundError.

    I am working with Echo, the web framework, MariaDB, and Prisma 2.
    Exercising CRUD simple posts, I encountered the problem when i update one post.

    I have let route "post/:id", which makes the post be updated. And uri parameter is id, such as 1, 2, 3
    In Echo framework, uri parameters can be accessed with c.Param("id").
    I triggered POST request with JSON object which includes title, and description as desc.
    But the terminal said the error pql error: Error in query graph construction: QueryParserError(QueryParserError { path: QueryPath { segments: ["Mutation", "updateOnePost"] }, error_kind: FieldNotFoundError }).

    I have predicted that if i launch post request to /posts/3, then title and content in post with id 3 should be changed, but not.

    I am going to attach Prisma schema code, echo request handler code, and JSON request body.
    I am using MariaDB, not PostgreSQL.

    model post {
      id        Int      @id @default(autoincrement())
      createdAt DateTime @default(now())
      updatedAt DateTime
      title     String
      published Boolean
      desc      String?
    
    type Post struct {
    	Title string `json:"title"`
    	Desc  string `json:"desc"`
    }
    var client *db.PrismaClient = db.NewClient()
    var ctx context.Context
    
    func init() {
    	ctx = context.Background()
            if err := client.Connect(); err != nil {
    		log.Panicln(err)
    	}
    }
    // UpdatePost Modifies a Post Being Already Created
    func UpdatePost(c echo.Context) error {
    	p := new(Post)
    	if err := c.Bind(p); err != nil {
    		log.Println(err.Error())
    		return c.JSON(http.StatusBadRequest, echo.Map{
    			"status": "fail",
    			"msg":    "Server Error",
    		})
    	}
    
    	id, err := strconv.Atoi(c.Param("id"))
    	if err != nil {
    		log.Println(err.Error())
    		return c.JSON(http.StatusBadRequest, echo.Map{
    			"status": "fail",
    			"msg":    "Server Error",
    		})
    	}
    
    	post, err := client.Post.FindOne(
    		db.Post.ID.Equals(id),
    	).Update(
    		db.Post.UpdatedAt.Set(time.Now()),
    		db.Post.Title.Set(p.Title),
    		db.Post.Published.Set(true),
    		db.Post.Desc.Set(p.Desc),
    	).Exec(ctx)
    	if err != nil {
    		log.Println(err.Error())
    		return c.JSON(http.StatusBadRequest, echo.Map{
    			"status": "fail",
    			"msg":    "Server Error",
    		})
    	}
    
    	str, err := json.MarshalIndent(post, "", " ")
    	if err != nil {
    		log.Println(err.Error())
    		return c.JSON(http.StatusBadRequest, echo.Map{
    			"status": "fail",
    			"msg":    "Server Error",
    		})
    	}
    	return c.JSON(http.StatusOK, echo.Map{
    		"status":         "OK",
    		"content-length": len(str),
    		"msg":            "The Post was modified as You Want",
    	})
    }
    
    {
        "title" : "Example Title Edited",
        "desc": "Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat."
    }
    

    the properties id, and createdAt is not required when creating.
    I have installed prisma-client-go latest version many times, and Echo version is v4.

    What is the problem?

  • .env file not being loaded at runtime

    .env file not being loaded at runtime

    Hello! I'm getting this error when trying to create a db connection:

    {
       "is_panic":false,
       "message":"\u001b[1;91merror\u001b[0m: \u001b[1mEnvironment variable not found: DATABASE_URL.\u001b[0m\n  \u001b[1;94m-->\u001b[0m  \u001b[4mschema.prisma:3\u001b[0m\n\u001b[1;94m   | \u001b[0m\n\u001b[1;94m 2 | \u001b[0m    provider = \"mysql\"\n\u001b[1;94m 3 | \u001b[0m    url      = \u001b[1;91menv(\"DATABASE_URL\")\u001b[0m\n\u001b[1;94m   | \u001b[0m\n\nValidation Error Count: 1",
       "meta":{
          "full_error":"\u001b[1;91merror\u001b[0m: \u001b[1mEnvironment variable not found: DATABASE_URL.\u001b[0m\n  \u001b[1;94m-->\u001b[0m  \u001b[4mschema.prisma:3\u001b[0m\n\u001b[1;94m   | \u001b[0m\n\u001b[1;94m 2 | \u001b[0m    provider = \"mysql\"\n\u001b[1;94m 3 | \u001b[0m    url      = \u001b[1;91menv(\"DATABASE_URL\")\u001b[0m\n\u001b[1;94m   | \u001b[0m\n\nValidation Error Count: 1"
       },
       "error_code":"P1012"
    }
    

    DATABASE_URL is from a .env file at the same level as my schema. I am able to create & run migrations with the migrate command. Does the Go client not yet support .env files?

    Schema:

    datasource db {
        provider = "mysql"
        url      = env("DATABASE_URL")
        output   = "prisma-gen"
    }
    
    generator db {
        provider = "go run github.com/prisma/prisma-client-go"
        package  = "prisma"
        output   = "prisma"
    }
    
    model User {
        id         String  @id @default(cuid())
        email      String  @unique
        password   String
        isVerified Boolean
    }
    
  • How to handle relations in query resolvers

    How to handle relations in query resolvers

    Hello there!

    I have a prisma schema with relations, similar to this one

    model User {
      id              String      @id @default(cuid())
      username        String      @unique
    
      projects        Project[]
    }
    
    model Project {
      id              String   @id @default(cuid())
      owner           User?    @relation(fields: [userId], references: [id])
      userId          String?
      name            String
    }
    

    with the following resolver function (via gqlgen):

    func (r *queryResolver) Users(ctx context.Context, after *model.UserWhereUniqueInput, before *model.UserWhereUniqueInput, first *int, last *int) ([]*model.User, error) {
    	users, err := r.Client.User.FindMany().Exec(ctx)
    
    	if err != nil {
    		return nil, err
    	}
    
    	retUsers := make([]*model.User, len(users))
    
    	for i, user := range users {
    		retUsers[i] = &model.User{
    			ID:        user.ID,
    			Username:  user.Username,,
    			Projects:  user.Projects,
    		}
    	}
    
    	return retUsers, err
    }
    

    The Problem is that Projects and user.Projects are of different types ( []*model.Project and []db.ProjectModel ).

    Do I have to iterate again over all projects in the user loop and make a client request/exec each time or can i bundle all of the requests/exec's?

  • chore(deps): bump github.com/stretchr/testify from 1.7.4 to 1.7.5

    chore(deps): bump github.com/stretchr/testify from 1.7.4 to 1.7.5

    Bumps github.com/stretchr/testify from 1.7.4 to 1.7.5.

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
  • Error in build docker image with prisma and go

    Error in build docker image with prisma and go

    Hi everyone. I am using prisma in golang and i have issue prisma/db is not in GOROOT. issue is showing on build docker image in gitlab.

    look the image bottom for the detail issue image

  • Prisma Client Go will not be Officially Maintained any more

    Prisma Client Go will not be Officially Maintained any more

    Hey everyone,

    After a lot of consideration, we've decided to stop the development on the Go Client. The Go client has unfortunately not seen the growth we were hoping for. To understand this decision a bit better, I'm sharing a chart that shows the number of installs over the last 12 months:

    image

    As you can see, there's been stable adoption, but not much growth.

    This doesn't mean that the Go client isn't useful or that the Go Client is a bad idea. We've just learned that the Go Client won't grow by itself. We would need to invest more resources to reach the kind of adoption we would need to sustain the development. Given our priorities for the next year, the Go Client just didn't make the cut.

    I'd like to take a moment to thank @steebchen for his work on the Go client for the last 2 years. He's been working tirelessly on answering questions, fixing bugs and implementing the features you've been asking for.

    I've added an FAQ below, but I'll leave this thread open to answer any additional questions you might have. We're sorry for the inconvenience this may cause you.

    FAQ

    When does the development stop?

    We are stopping the development of the Go Client immediately.

    Will critical issues and bugs be fixed?

    Unfortunately, we won’t have any resources to fix any outstanding or upcoming issues with the Go Client. Community members are more than welcome to fork the repo and continue the development of the Go Client on their own (as a reference, you can look at the Python Client which has been developed from scratch by a community member as well). If anyone is interested in that, we are happy to help with the first steps in adopting and distributing.

    What is going to happen to the repo?

    This repository will remain in place as a point of reference.

    Will you change your mind in the future and pick up the development again?

    Possibly. As we grow larger and reach more enterprises, the Go ecosystem is likely to become more relevant again. The type of Go Client we offer then may look different than the current one though.

  • Panic exit after running generate

    Panic exit after running generate

    Hi folks. We're currently using Prisma with our nodejs project, but our Go services use static queries that may drift in the future. We'd like to use the Prisma schema as a source of truth and integrate with the code generated from this library. However, can't seem to find a way around the panic error I'm receiving after using the same schema used in our node service.

    The error I'm receiving:

    $ go run github.com/prisma/prisma-client-go generate
    Prisma schema loaded from schema.prisma
    Error:
                    SpatialRefSys spatialRefSysActions
    }
     from file client.gotpl: 230242:28: expected ';', found npx (and 91 more errors)
    exit status 1
    
    
    
    panic: could not run [generate]: exit status 1
    
    goroutine 1 [running]:
    main.main()
            /Users/me/Development/go/pkg/mod/github.com/prisma/[email protected]/main.go:29 +0x40c
    exit status 2
    

    From what I can tell, the table doesn't actually matter. The error will always return the last table in the schema if I comment out things.

    Not sure if it's helpful, but there are 63 tables and nearly 1000 lines of code in the schema. This is at the top of the schema if that helps with debugging:

    generator client {
      output = "db_gen.go"
      package = "db"
      provider      = "go run github.com/prisma/prisma-client-go"
      // binaryTargets = ["native"]
      // provider      = "prisma-client-js"
    }
    
    datasource db {
      provider = "postgresql"
      url      = env("DATABASE_URL")
    }
    

    Thanks for taking a look!

  • Error in query graph construction when trying to attach m2m with .InIfPresent

    Error in query graph construction when trying to attach m2m with .InIfPresent

    Hey. I have a Category and Post linked together with a many to many relationship. A post can have many categories and a category can have many Posts. I'm trying to Link a category to a Post, like this:

    	// Link the category to the post
    	_, err = client.Post.FindUnique(db.Post.ID.Equals(post.ID)).
    		Update(db.Post.Categories.Link(
    			db.Category.ID.InIfPresent([]int{category.ID}),
    		),
    		).
    		Exec(ctx)
    

    But I'm getting this error. I've made a small reproduction at https://github.com/hi019/prisma-go-issue. Using db.Category.ID.Equals(category.ID) instead of the InIfPresent works, but I would like to pass a slice of ids if possible.

gqlgenc is a fully featured go gql client, powered by codegen

gqlgenc Note: ⚠️ This is a WIP, backward-compatibility cannot be guaranteed yet, use at your own risk gqlgenc is a fully featured go gql client, power

Apr 23, 2022
GoSNMP is an SNMP client library fully written in Go

GoSNMP is an SNMP client library fully written in Go. It provides Get, GetNext, GetBulk, Walk, BulkWalk, Set and Traps. It supports IPv4 and IPv6, using SNMPv1, SNMPv2c or SNMPv3. Builds are tested against linux/amd64 and linux/386.

Jun 30, 2022
Fast Telegram client fully in go.

Telegram client, in Go. (MTProto API)

Jul 3, 2022
GoSNMP is an SNMP client library fully written in Go.

GoSNMP is an SNMP client library fully written in Go. It provides Get, GetNext, GetBulk, Walk, BulkWalk, Set and Traps. It supports IPv4 and IPv6, using SNMPv1, SNMPv2c or SNMPv3. Builds are tested against linux/amd64 and linux/386.

Oct 28, 2021
Create a gRPC server from code generated by sqlc

sqlc-grpc Create a gRPC Server from the generated code by the awesome sqlc project. Dependencies Go 1.16 or superior protoc sqlc, protoc-gen-go and pr

Jun 27, 2022
May 4, 2022
A simple Go library to toggle on and off pac(proxy auto configuration) for Windows, MacOS and Linux

pac pac is a simple Go library to toggle on and off pac(proxy auto configuration

Dec 26, 2021
Laptop Booking Application in Golang and gRPC, load-balancing with NGINX, and fully compatible with HTTPS OpenAPI v3

Laptop Booking Application in Golang and gRPC Goals GitHub CI & Coverage Badge Serialize protobuf messages Create laptop unary gRPC Search laptop Serv

Jun 17, 2022
Gmqtt is a flexible, high-performance MQTT broker library that fully implements the MQTT protocol V3.1.1 and V5 in golang

中文文档 Gmqtt News: MQTT V5 is now supported. But due to those new features in v5, there area lots of breaking changes. If you have any migration problem

Jul 4, 2022
This project provides fully automated one-click experience to create Cloud and Kubernetes environment to run Data Analytics workload like Apache Spark.
This project provides fully automated one-click experience to create Cloud and Kubernetes environment to run Data Analytics workload like Apache Spark.

Introduction This project provides a fully automated one-click tool to create Data Analytics platform in Cloud and Kubernetes environment: Single scri

May 31, 2022
socks5 proxy server with auto upstream selection

atproxy socks5 proxy server with auto upstream selection installation go install github.com/reusee/atproxy/[email protected] select process for each cli

Dec 22, 2021
Diag - Auto Diagdnosis error log for golang

Diag 1:自动诊断产品日志中的报错信息,进行知识库比对,并给出解决方案 \n 2:prometheus 本地数据 api 拉取展示,应对 sm0.2 版本或

Jan 28, 2022
OpenTelemetry auto-instrumentation for Go applications

OpenTelemetry Auto-Instrumentation for Go This project adds OpenTelemetry instrumentation to Go applications without having to modify their source cod

Jul 1, 2022
Automatically spawn a reverse shell fully interactive for Linux or Windows victim
Automatically spawn a reverse shell fully interactive for Linux or Windows victim

Girsh (Golang Interactive Reverse SHell) Who didn't get bored of manually typing the few lines to upgrade a reverse shell to a full interactive revers

Jun 27, 2022
纯Go编写的IM,完全自定义协议的高性能即时通讯服务(High-performance instant messaging service with fully customizable protocol)
纯Go编写的IM,完全自定义协议的高性能即时通讯服务(High-performance instant messaging service with fully customizable protocol)

LiMaoIM (Everything so easy) This project is a simple and easy to use, powerful performance, simple design concept instant messaging service, fully cu

Jul 3, 2022
DeSo is a blockchain built from the ground up to support a fully-featured social network

DeSo is a blockchain built from the ground up to support a fully-featured social network. Its architecture is similar to Bitcoin, only it supports complex social network data like profiles, posts, follows, creator coin transactions, and more.

Jun 8, 2022
Xray, Penetrates Everything. Also the best v2ray-core, with XTLS support. Fully compatible configuration.

Project X Project X originates from XTLS protocol, provides a set of network tools such as Xray-core and Xray-flutter. License Mozilla Public License

Jun 26, 2022
Episode VII: The DB Awakens (fully stablished JSON communication system)

APITrials0.7 Episode VII: The DB Awakens (fully stablished JSON communication system) Captain's log: Im too deep into the rabbit hole now. This seems

Jan 10, 2022
Subfinder is a subdomain discovery tool that discovers valid subdomains for websites. Designed as a passive framework to be useful for bug bounties and safe for penetration testing.
Subfinder is a subdomain discovery tool that discovers valid subdomains for websites. Designed as a passive framework to be useful for bug bounties and safe for penetration testing.

Fast passive subdomain enumeration tool. Features • Install • Usage • API Setup • License • Join Discord Subfinder is a subdomain discovery tool that

Jul 3, 2022