Skip to content

ColeBurch/pgx-govalues-decimal

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pgx-govalues-decimal

This repository is a modification of pgx-shopspring-decimal. Provides govalues/decimal type support for github.com/jackc/pgx PostgreSQL driver.

Installation

go get github.com/ColeBurch/pgx-govalues-decimal

Usage example

package main

import (
  "context"
  "os"

  "github.com/jackc/pgx/v5"
  "github.com/jackc/pgx/v5/pgxpool"
  pgxDecimal "github.com/ColeBurch/pgx-govalues-decimal"
)

func main() {
  pgxConfig, err := pgxpool.ParseConfig(os.Getenv("PG_URI"))
  if err != nil {
    panic(err)
  }

  pgxConfig.AfterConnect = func(ctx context.Context, conn *pgx.Conn) error {
    pgxDecimal.Register(conn.TypeMap())
    return nil
  }

  pgxConnPool, err := pgxpool.NewWithConfig(context.TODO(), pgxConfig)
  if err != nil {
    panic(err)
  }

  // use pgxConnPool
  ...
}

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages