gomonetary is a pure go package for parsing and formatting monetary values.
elliotcourant/go-pg-multitenant 1
go-pg/pg multi-tenant example
acrtonyx is a rust based SQL database experiment.
This is a research project for creating a fast an efficient relational SQL database on top of a key-value store.
Fast key-value DB in Go.
BadgerHold is an embeddable NoSQL store for querying Go types built on Badger
Buffers is just a simple helper package for reading and writing byte arrays.
CockroachDB - the open source, cloud-native SQL database.
My personal development dotfiles.
A pure go implementation of the epaxos consensus algorithm.
push eventgo-pg/pg
commit sha a4c7a0cffd748788a360fb36a7ebe3e4ce30e413
Add banner
commit sha cc4a393f3ccd7c38e5a9604f9c38b91b609a8867
Otel v0.18
push time in 10 hours
created taggo-pg/pg
Golang ORM with focus on PostgreSQL features and performance
created time in 10 hours
created taggo-pg/pg
Golang ORM with focus on PostgreSQL features and performance
created time in 10 hours
push eventgo-pg/pg
commit sha c1026b84e1d177c048e5c3815279ac0532719c56
Otel v0.18
push time in 11 hours
issue openedgo-pg/pg
M2M: pk bigserial and 2 fk uuid lead to pk used on fk (seems only appear with uuid type)
<!--- Provide a general summary of the issue in the Title above -->
I am creating a many 2 many table with one primary key as bigserial auto-increment and then the two FK with a unique group. The two foreign keys ids are UUIDs.
The tables look like that:
type UserTest struct {
ID uuid.UUID `pg:",type:uuid"`
Permissions []PermissionTest `pg:"many2many:upt"`
}
type PermissionTest struct {
ID uuid.UUID `pg:",type:uuid"`
}
type UsersPermissionsTest struct {
tableName struct{} `pg:"upt"`
ID int `pg:"id,pk"`
PermissionID uuid.UUID `pg:"permission_test_id,type:uuid,unique:idx_upt_unique"`
UserID uuid.UUID `pg:"user_test_id,type:uuid,unique:idx_users_upt_unique"`
}
Current Behavior
When fetching the relation of the many 2 many table instead of setting the permission id to the corresponding column in the select the ORM is trying to set the pk which is int to the FK permission id which is a UUID. (IDK if it's clear)
This is the final selection:
SELECT "users_permissions_test".*, "permission_test"."id" FROM "permission_tests" AS "permission_test"
JOIN "upt" AS "users_permissions_test" ON ("users_permissions_test"."user_test_id") IN ('25289c7f-e733-4903-a8a3-e1569712ea69')
WHERE ("permission_test"."id" = "users_permissions_test"."permission_test_id")
The ORM is trying to assign "user_permissions_test"."id" to the Permission.ID struct. Which lead to panic: uuid: incorrect UUID length
This error happens with the UUID type. If you replace Permissions Ids and User ids with int it works suddenly as expected. The Permission.ID is correctly set from the "user_permissions_test"."permission_test_id" and not from the "user_permissions_test"."id". (that is surprising)
Expected Behavior
The ORM must correctly set the Permission ID from the "user_permissions_test"."permission_test_id" and not from the "user_permissions_test"."id".
Possible Solution
Yesterday I was diving into your code and it seems like the many to many scanner have an empty columns map field while scanning the first column (which is the id from user_permissions_test).
Likely too deep to understand why this bug happens. I just saw today that the problem only appear with UUID I first though that it was a bug because my foreign keys aren't the primary composite key, but it's not the case.
Steps to Reproduce
Launch this code:
package main
import (
"fmt"
"github.com/go-pg/pg/extra/pgdebug"
"github.com/go-pg/pg/v10"
"github.com/go-pg/pg/v10/orm"
uuid "github.com/satori/go.uuid"
)
type UserTest struct {
ID uuid.UUID `pg:",type:uuid"`
Permissions []PermissionTest `pg:"many2many:upt"`
}
type PermissionTest struct {
ID uuid.UUID `pg:",type:uuid"`
}
type UsersPermissionsTest struct {
tableName struct{} `pg:"upt"`
ID int `pg:"id,pk"`
PermissionID uuid.UUID `pg:"permission_test_id,type:uuid,unique:idx_upt_unique"`
UserID uuid.UUID `pg:"user_test_id,type:uuid,unique:idx_users_upt_unique"`
}
func Example() {
opts, _ := pg.ParseURL("postgresql://asvf-montagne-api:asvf-montagne-api@localhost:5172/asvf-montagne-api?sslmode=disable")
db := pg.Connect(opts)
defer db.Close()
db.AddQueryHook(pgdebug.DebugHook{
Verbose: true,
})
if err := createManyToManyTables(db); err != nil {
panic(err)
}
userid := uuid.NewV4()
permid := uuid.NewV4()
values := []interface{}{
&UserTest{ID: userid},
&PermissionTest{ID: permid},
&UsersPermissionsTest{ID: 30, UserID: userid, PermissionID: permid},
}
for _, v := range values {
_, err := db.Model(v).Insert()
if err != nil {
panic(err)
}
}
u := new(UserTest)
err := db.Model(u).Relation("Permissions").First()
if err != nil {
panic(err)
}
fmt.Println("User", u.ID, "Permission", u.Permissions)
}
func createManyToManyTables(db *pg.DB) error {
orm.RegisterTable((*UsersPermissionsTest)(nil))
models := []interface{}{
(*UserTest)(nil),
(*PermissionTest)(nil),
(*UsersPermissionsTest)(nil),
}
for _, model := range models {
err := db.Model(model).CreateTable(&orm.CreateTableOptions{
Temp: true,
})
if err != nil {
return err
}
}
return nil
}
func main() {
Example()
}
You should have this output:
CREATE TEMP TABLE "user_tests" ("id" uuid, PRIMARY KEY ("id"))
CREATE TEMP TABLE "permission_tests" ("id" uuid, PRIMARY KEY ("id"))
CREATE TEMP TABLE "upt" ("id" bigserial, "permission_test_id" uuid, "user_test_id" uuid, PRIMARY KEY ("id"), UNIQUE ("permission_test_id"), UNIQUE ("user_test_id"))
INSERT INTO "user_tests" ("id") VALUES ('25289c7f-e733-4903-a8a3-e1569712ea69')
INSERT INTO "permission_tests" ("id") VALUES ('86aca506-d00e-4028-aa22-10939dd4d326')
INSERT INTO "upt" ("id", "permission_test_id", "user_test_id") VALUES (30, '86aca506-d00e-4028-aa22-10939dd4d326', '25289c7f-e733-4903-a8a3-e1569712ea69')
SELECT "user_test"."id" FROM "user_tests" AS "user_test" ORDER BY "user_test"."id" LIMIT 1
SELECT "users_permissions_test".*, "permission_test"."id" FROM "permission_tests" AS "permission_test" JOIN "upt" AS "users_permissions_test" ON ("users_permissions_test"."user_test_id") IN ('25289c7f-e733-4903-a8a3-e1569712ea69') WHERE ("permission_test"."id" = "users_permissions_test"."permission_test_id")
panic: uuid: incorrect UUID length: 30 <--- the error
Context (Environment)
I'm just trying to bind what I have in my database. The link table has fields with the id as a primary key and two other FK as UUIDs.
There is no black magic it's a simple case, I don't know why it isn't working, I was expecting it to works.
created time in 12 hours
issue commentgo-pg/pg
try to specify conflict fields: .OnConflict("(id) DO NOTHING")
comment created time in 13 hours
pull request commenttebru/gson-php
Support PHP 8.0 and phpDocumentor/ReflectionDocBlock 5.0
Should I update the tests to use a different way to looking at private properties? If the goal is to verify the structure of generated files, maybe we could use reflection and assert on that.
assertAttributeSame() is deprecated and will be removed in PHPUnit 9.
readAttribute() is deprecated and will be removed in PHPUnit 9.
getObjectAttribute() is deprecated and will be removed in PHPUnit 9.
assertAttributeInstanceOf() is deprecated and will be removed in PHPUnit 9.
comment created time in a day
pull request commenttebru/gson-php
[DRAFT] Allow phpdocumentor/reflection-docblock v5
Replaced with https://github.com/tebru/gson-php/pull/55
comment created time in 2 days
issue commentgo-pg/pg
Support Multiple columns on relation.
I've used the following and it's worked, but idk if it's the intended way of using it:
db.Relation("User.id").Relation("User.name")
I agree though that it'd be simpler if it were just a simple Relation call.
comment created time in 4 days
push eventhashicorp/raft
commit sha 9a26d59dd4670a366186f0872ba74b8cfcbe76ce
Allow buffered applyCh (#445) * Allow buffered applyCh * comment
push time in 4 days
PR merged hashicorp/raft
This piggybacks off the discussion around https://github.com/hashicorp/raft/pull/124 While we acknowledge this discrepancy in timeout assumptions, it could still be valuable to at least expose the option to buffer the applyCh
pr closed time in 4 days
PR opened hashicorp/raft
This piggybacks off the discussion around https://github.com/hashicorp/raft/pull/124 While we acknowledge this discrepancy in timeout assumptions, it could still be valuable to at least expose the option to buffer the applyCh
pr created time in 4 days
PR closed hashicorp/raft
This change implements the solution suggested in https://github.com/hashicorp/raft/pull/124 to enable batch processing off the raft applyCh
For context, our application uses this library, and we are currently bottlenecked by StoreLogs throughput. We believe we can boost this throughput by increasing batch size in StoreLogs, which fsync's on each call.
Appreciate all the help team 💯
pr closed time in 4 days
push eventgo-pg/pg
commit sha b12967819e5960f90cdac249c973603f15210759
Add banner
push time in 4 days
issue openedgo-pg/pg
Support Multiple columns on relation.
Issue tracker is used for reporting bugs and discussing new features. Please use Discord or stackoverflow for supporting issues.
<!--- Provide a general summary of the issue in the Title above -->
Expected Behavior
Support for selecting multiple columns when using Relation.
<!--- Tell us what should happen -->
Current Behavior
Currently It just selects one column only no matter how many columns you specify.
<!--- Tell us what happens instead of the expected behavior -->
Possible Solution
db.Relation("User.id").ComunExpr(`"user"."name" as "user__name"`)
<!--- Not obligatory, but suggest a fix/reason for the bug, -->
Context (Environment)
In many cases we have to select multiple columns which is not possible without use of ColumnExpr(), supporting within a relation would greatly facilitate.
<!--- How has this issue affected you? What are you trying to accomplish? --> <!--- Providing context helps us come up with a solution that is most useful in the real world -->
<!--- Provide a general summary of the issue in the Title above -->
Detailed Description
<!--- Provide a detailed description of the change or addition you are proposing -->
Possible Implementation
db.Relation("User,id,name")
<!--- Not obligatory, but suggest an idea for implementing addition or change -->
created time in 4 days
issue commentgo-pg/pg
ERROR #42P01 missing FROM-clause entry for table "_data"
I've the same issue while working on many2many relation.
comment created time in 6 days
Pull request review commenthashicorp/raft
Make snapshot timing and trailing logs hot-reloadable in raft
type Config struct { // we can become a leader of a cluster containing only this node. ShutdownOnRemove bool - // TrailingLogs controls how many logs we leave after a snapshot. This is- // used so that we can quickly replay logs on a follower instead of being- // forced to send an entire snapshot.+ // TrailingLogs controls how many logs we leave after a snapshot. This is used+ // so that we can quickly replay logs on a follower instead of being forced to+ // send an entire snapshot. The value passed here is the initial setting used.+ // This can be tuned during operation using
TODO:
- [ ] fix this comment and docs generally if we are happy with this API approach (duplicating fields)
comment created time in 7 days
pull request commenthashicorp/raft
Make snapshot timing and trailing logs hot-reloadable in raft
We are still having some issues with tests in CI, but the suite passes locally for me and the new tests I added pass using -race too FWIW.
comment created time in 7 days
PR opened hashicorp/raft
These parameters are reasonably easy to make reloadable in a running raft instance.
Other parameters like the timeouts may be too although some require more thought about whether they are safe to change at runtime, however I'm sticking with these three right now as they are the critical parameters needed to get out of an otherwise unrecoverable situation detailed in https://github.com/hashicorp/consul/issues/9609.
There are other possible mitigations and solutions to that problem including my previous WIP PR that prevents snapshotting during replication entirely, but this has fewer uncertainties about safety and is the simplest change that gives a manual intervention option where almost none exists today.
If others are happy with this change, we can merge it and then allow Consul (and others) to have a way to re-configure snapshotting and log pruning on a leader without restarting it and loosing leadership.
pr created time in 7 days
PR opened hashicorp/raft
Noticed while submitting https://github.com/hashicorp/raft/pull/442 that this repo is missing tests for the latest two versions of Go.
pr created time in 7 days
pull request commenthashicorp/raft
Add String() to LogType enum for easier debugging.
Thank you for your submission! We require that all contributors sign our Contributor License Agreement ("CLA") before we can accept the contribution. Read and sign the agreement
Learn more about why HashiCorp requires a CLA and what the CLA includes
<sub>Have you signed the CLA already but the status is still pending? Recheck it.</sub>
comment created time in 7 days
PR opened hashicorp/raft
pr created time in 7 days
issue closedgo-pg/pg
How to scan multiple rows' value (of same column) to a slice?
I want to do something like this, apparenty it dosn't work.
var names []string
db.Query(pg.Scan(&names), `select name from foo`)
closed time in 7 days
thetruecharissue commentgo-pg/pg
How to scan multiple rows' value (of same column) to a slice?
For a single column you can use
var strs pg.Strings
db.Query(&strs, `select name from foo`)
comment created time in 7 days