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

Infinite loop on types that reference eachother #107

Closed
CmpHDL opened this issue Dec 1, 2021 · 29 comments
Closed

Infinite loop on types that reference eachother #107

CmpHDL opened this issue Dec 1, 2021 · 29 comments
Labels
enhancement New feature or request

Comments

@CmpHDL
Copy link

CmpHDL commented Dec 1, 2021

type TableOne struct {
    model.TableOnes

    TableTwos []TableTwo
}

type TableTwo struct {
    model.TableTwos

    TableOne TableOne
}

Preforming a stmt.Query with either of these structs (or anything that has either of these structs) will load infinitely.
No error is returned, it was incredibly long and time consuming to find the source of the issue.

I have tried making the types pointers to no avail. (idea being they would become nullable)
This pattern is common when you have a Has(One/Many)BelongsTo relationship.

@go-jet
Copy link
Owner

go-jet commented Dec 2, 2021

Hi. Assuming you want to scan into TableOne destination, why would you want to copy that the same destination n times in the TableTwos array? Or in the case of pointer, n pointers to root scan destination? Those data are already there.

Scanner should be able to catch up circular dependency and return an error, so this can be implemented in the future. Allowing pointer might make sense in some scenarios(something to think about).

But recommendation would be to not to use circular dependencies:

type TableOne struct {
    model.TableOnes

    TableTwos []model.TableTwos
}

@CmpHDL
Copy link
Author

CmpHDL commented Dec 2, 2021

It's part of a typical schema, I believe GORM even has an example in their docs. If you have a HasMany/HasOne relationship, at the other end you have a BelongsTo, if you need to access the parent table from the child (very common) you have to have the child reference the parent's type.

@CmpHDL
Copy link
Author

CmpHDL commented Dec 2, 2021

Hi. Assuming you want to scan into TableOne destination, why would you want to copy that the same destination n times in the TableTwos array? Or in the case of pointer, n pointers to root scan destination? Those data are already there.

Scanner should be able to catch up circular dependency and return an error, so this can be implemented in the future. Allowing pointer might make sense in some scenarios(something to think about).

But recommendation would be to not to use circular dependencies:

type TableOne struct {
    model.TableOnes

    TableTwos []model.TableTwos
}

The data is different, you basically have one path of data being loaded.
More typical is

Table 4 -> Table 3 -> Table 2 -> []Table 1 (I'm table 2, grab all my children) and
Table 5 -> Table 6 -> []Table 1 => Table 2 (I'm table 1, grab my parent)

In the first path I have to access table 2 through table 3 as the reference for table 3 is in table 4 and table 3 has no table 1 reference
In the second path I have to access table 2 through table 1 as table 6 has a reference for table 1 but not table 2.

This is common when having two foreign keys (parents) on the same table.

@CmpHDL
Copy link
Author

CmpHDL commented Dec 3, 2021

@go-jet Any ideas on this? It shouldn't return an error as it wouldn't be instances pointing to eachother, the objects can simply have eachother's type as a type of a field (or as a slice of said type). The current workaround for this requires another library and is a bit hacky in terms of implementation.

@go-jet
Copy link
Owner

go-jet commented Dec 3, 2021

Don't see many problems with supporting a pointer to shared scan data. The only issue would be, because all database tables are related in one way or the other, scan destination would be always a complex struct containing all the db models. This might slowdown the scan, because the scan would need to introspect every model in that destination. But eventually this would be developer decision, so it isn't a big issue.

@go-jet go-jet added the enhancement New feature or request label Dec 3, 2021
@go-jet go-jet added this to the Version 2.7.0 milestone Dec 3, 2021
@CmpHDL
Copy link
Author

CmpHDL commented Dec 3, 2021

A pointer to shared scan data? The issue lies when two structs use eachother as a type.
"scan destination would be always a complex struct containing all the db models. "
A complex struct, yes, but not all of the db models, just the ones related to that struct being pointed to.
The complex struct would be essentially be a 'slice' of the database.

type TableOne struct {
    model.TableOnes

    TableTwos []TableTwo
}

type TableTwo struct {
    model.TableTwos

    TableOne TableOne
}

If I'm working from TableOne and wanted all its TableTwo children
stmt := TableOne innerjoin TableTwo on TableTwo.table_one_id = TableOne.id
var tableOne TableOne
query(db, &TableOne)
// now I have many TableTwo that belong to TableOne in my TableOne.TableTwos

If I'm working from TableTwo in a completely different area and wanted to use its parent for something
stmt := TableTwo innerjoin TableOne on TableOne.id = TableTwo.table_one
var tableTwo TableTwo
query(db, &TableTwo)
// now I have one TableOne in my TableTwo.TableOne

Typically the first scenario, you're doing an everyday say
User -> Ticket -> []TicketRelpies

table ticket_replies has ticket.id and whatever.id
And in the second scenario, you're somewhere else accessing whatever, which TicketReplies has an ID to grab the Ticket that whatever is apart of you'd do
Whatever -> TicketReply -> Ticket

Hence why you'd need TicketReplies on Ticket and Ticket on TicketReply

@CmpHDL
Copy link
Author

CmpHDL commented Dec 7, 2021

@go-jet Is there any target date for 2.7? I'm refactoring our entire codebase to use go-jet and this is currently the only issue we're having and to get around it theres a lot of boilerplate, err != nil checking, and inefficient data-usage. (looping and copying data)

@go-jet
Copy link
Owner

go-jet commented Dec 7, 2021

Version 2.7 will probably be released in February or after. In the meantime, you can use type-recursion branch. On this branch types scan recursions are prevented(test1, test2).

@CmpHDL
Copy link
Author

CmpHDL commented Dec 7, 2021

Version 2.7 will probably be released in February or after. In the meantime, you can use type-recursion branch. On this branch types scan recursions are prevented(test1, test2).

You're awesome! This worked when I tried a test struct I made which failed on the initial branch it seemed to work perfectly!
On the complex struct (multiple nested etc) its giving me an error.

reflect: slice index out of range

Heres the stacktrace

021/12/07 12:00:03 stderr:  /go/pkg/mod/github.com/go-jet/jet/v2@v2.5.1-0.20211207161610-1b1d50adcfdd/qrm/utill.go:43 +0x32

2021/12/07 12:00:03 stderr: github.com/go-jet/jet/v2/qrm.mapRowToSlice(0xc0000b6140, {0xc00007e210, 0x2a}, 0xc0000e99e0, {0xc0000b6680, 0xc0001601c8, 0xc0000ea950}, 0xc0002ae230)

2021/12/07 12:00:03 stderr:  /go/pkg/mod/github.com/go-jet/jet/v2@v2.5.1-0.20211207161610-1b1d50adcfdd/qrm/qrm.go:190 +0x39a

2021/12/07 12:00:03 stderr: github.com/go-jet/jet/v2/qrm.mapRowToDestinationPtr(0x826480, {0xc00007e210, 0x2a}, 0x1, {0xc0000b6680, 0xc0001601c8, 0x885500}, 0xc0002ae230)

2021/12/07 12:00:03 stderr:  /go/pkg/mod/github.com/go-jet/jet/v2@v2.5.1-0.20211207161610-1b1d50adcfdd/qrm/qrm.go:364 +0xe5

2021/12/07 12:00:03 stderr: github.com/go-jet/jet/v2/qrm.mapRowToDestinationValue(0x885500, {0xc00007e210, 0x2a}, 0x0, {0x826480, 0xc0001601c8, 0x81a6ae}, 0x1a)

2021/12/07 12:00:03 stderr:  /go/pkg/mod/github.com/go-jet/jet/v2@v2.5.1-0.20211207161610-1b1d50adcfdd/qrm/qrm.go:337 +0x178

2021/12/07 12:00:03 stderr: github.com/go-jet/jet/v2/qrm.mapRowToStruct(0xc0000e9d28, {0xc00007e210, 0x2a}, 0xc00010e950, {0x857fe0, 0xc000160100, 0xc0000e9e18}, 0xc0000e9d60, {0x0, 0x0, ...})

2021/12/07 12:00:03 stderr:  /go/pkg/mod/github.com/go-jet/jet/v2@v2.5.1-0.20211207161610-1b1d50adcfdd/qrm/qrm.go:271 +0x5f8

2021/12/07 12:00:03 stderr: github.com/go-jet/jet/v2/qrm.mapRowToDestinationPtr(0x885500, {0xc00007e210, 0x2a}, 0x1, {0x857fe0, 0xc000160100, 0x871c40}, 0xc0002a7260)

2021/12/07 12:00:03 stderr:  /go/pkg/mod/github.com/go-jet/jet/v2@v2.5.1-0.20211207161610-1b1d50adcfdd/qrm/qrm.go:362 +0x139

2021/12/07 12:00:03 stderr: github.com/go-jet/jet/v2/qrm.mapRowToDestinationValue(0x871c40, {0xc00007e210, 0x2a}, 0x0, {0x885500, 0xc000160100, 0x81027a}, 0xe)

2021/12/07 12:00:03 stderr:  /go/pkg/mod/github.com/go-jet/jet/v2@v2.5.1-0.20211207161610-1b1d50adcfdd/qrm/qrm.go:337 +0x178

2021/12/07 12:00:03 stderr: github.com/go-jet/jet/v2/qrm.mapRowToStruct(0xc0000ea070, {0xc00007e210, 0x2a}, 0xc00010e950, {0x81c600, 0xc000160090, 0xc0000ea160}, 0xc0000ea0a8, {0x0, 0x0, ...})

2021/12/07 12:00:03 stderr:  /go/pkg/mod/github.com/go-jet/jet/v2@v2.5.1-0.20211207161610-1b1d50adcfdd/qrm/qrm.go:271 +0x5f8

2021/12/07 12:00:03 stderr: github.com/go-jet/jet/v2/qrm.mapRowToDestinationPtr(0x871c40, {0xc00007e210, 0x2a}, 0x1, {0x81c600, 0xc000160090, 0x8650e0}, 0xc0002a6af0)

2021/12/07 12:00:03 stderr:  /go/pkg/mod/github.com/go-jet/jet/v2@v2.5.1-0.20211207161610-1b1d50adcfdd/qrm/qrm.go:362 +0x139

2021/12/07 12:00:03 stderr: github.com/go-jet/jet/v2/qrm.mapRowToDestinationValue(0x8650e0, {0xc00007e210, 0x2a}, 0x0, {0x871c40, 0xc000160090, 0x81338b}, 0x15)

2021/12/07 12:00:03 stderr:  /go/pkg/mod/github.com/go-jet/jet/v2@v2.5.1-0.20211207161610-1b1d50adcfdd/qrm/qrm.go:337 +0x178

2021/12/07 12:00:03 stderr: github.com/go-jet/jet/v2/qrm.mapRowToStruct(0x2a, {0xc00007e210, 0x2a}, 0xc00010e950, {0x81c6c0, 0xc000160000, 0x80cb21}, 0x46b889, {0x0, 0x0, ...})

2021/12/07 12:00:03 stderr:  /go/pkg/mod/github.com/go-jet/jet/v2@v2.5.1-0.20211207161610-1b1d50adcfdd/qrm/qrm.go:271 +0x5f8

2021/12/07 12:00:03 stderr: github.com/go-jet/jet/v2/qrm.mapRowToSlice(0xc0000b6140, {0xc0000244c8, 0x11}, 0xc0000ea4b0, {0xc0000b6580, 0xc0000b00c8, 0xc0000ea950}, 0xc000292ee0)

2021/12/07 12:00:03 stderr:  /go/pkg/mod/github.com/go-jet/jet/v2@v2.5.1-0.20211207161610-1b1d50adcfdd/qrm/qrm.go:197 +0x292

2021/12/07 12:00:03 stderr: github.com/go-jet/jet/v2/qrm.mapRowToDestinationPtr(0x8263c0, {0xc0000244c8, 0x11}, 0x1, {0xc0000b6580, 0xc0000b00c8, 0x871d00}, 0xc000292ee0)

2021/12/07 12:00:03 stderr:  /go/pkg/mod/github.com/go-jet/jet/v2@v2.5.1-0.20211207161610-1b1d50adcfdd/qrm/qrm.go:364 +0xe5

2021/12/07 12:00:03 stderr: github.com/go-jet/jet/v2/qrm.mapRowToDestinationValue(0x871d00, {0xc0000244c8, 0x11}, 0x0, {0x8263c0, 0xc0000b00c8, 0x815204}, 0x12)

2021/12/07 12:00:03 stderr:  /go/pkg/mod/github.com/go-jet/jet/v2@v2.5.1-0.20211207161610-1b1d50adcfdd/qrm/qrm.go:337 +0x178

2021/12/07 12:00:03 stderr: github.com/go-jet/jet/v2/qrm.mapRowToStruct(0x11, {0xc0000244c8, 0x11}, 0xc00010e950, {0x81c680, 0xc0000b0080, 0x40e914}, 0xc0000ea877, {0x0, 0x0, ...})

2021/12/07 12:00:03 stderr:  /go/pkg/mod/github.com/go-jet/jet/v2@v2.5.1-0.20211207161610-1b1d50adcfdd/qrm/qrm.go:271 +0x5f8

2021/12/07 12:00:03 stderr: github.com/go-jet/jet/v2/qrm.mapRowToSlice(0xc0000b6140, {0x0, 0x0}, 0xc00013d200, {0x81bc40, 0xc0000f62d0, 0x1}, 0x0)

2021/12/07 12:00:03 stderr:  /go/pkg/mod/github.com/go-jet/jet/v2@v2.5.1-0.20211207161610-1b1d50adcfdd/qrm/qrm.go:197 +0x292

2021/12/07 12:00:03 stderr: github.com/go-jet/jet/v2/qrm.queryToSlice({0x961d90, 0xc000026060}, {0x961ee0, 0xc00007d5f0}, {0xc00013d200, 0xc0000eaa08}, {0xc0004409d0, 0x7561fc, 0xc0000ea9e8}, {0x81bc40, ...})

2021/12/07 12:00:03 stderr:  /go/pkg/mod/github.com/go-jet/jet/v2@v2.5.1-0.20211207161610-1b1d50adcfdd/qrm/qrm.go:144 +0x32d

2021/12/07 12:00:03 stderr: github.com/go-jet/jet/v2/qrm.Query({0x961d90, 0xc000026060}, {0x961ee0, 0xc00007d5f0}, {0xc00013d200, 0x81e}, {0xc0004409d0, 0x1, 0x1}, {0x81bc40, ...})

2021/12/07 12:00:03 stderr:  /go/pkg/mod/github.com/go-jet/jet/v2@v2.5.1-0.20211207161610-1b1d50adcfdd/qrm/qrm.go:29 +0x1bb

2021/12/07 12:00:03 stderr: github.com/go-jet/jet/v2/internal/jet.(*serializerStatementInterfaceImpl).Query(0xc0004143c0, {0x961ee0, 0xc00007d5f0}, {0x81bc40, 0xc0000f62d0})

2021/12/07 12:00:03 stderr:  /go/pkg/mod/github.com/go-jet/jet/v2@v2.5.1-0.20211207161610-1b1d50adcfdd/internal/jet/statement.go:86 +0x12f

@CmpHDL
Copy link
Author

CmpHDL commented Dec 7, 2021

Got it to work by adding table.JoinedTable.ID to the select (not just inner join), going to look at why this is but branch seems to work :)!

Thanks a million @go-jet

@CmpHDL
Copy link
Author

CmpHDL commented Dec 7, 2021

Went from 13-20ms to 5-6ms! On a production sized table this difference would be massive.

@CmpHDL
Copy link
Author

CmpHDL commented Dec 7, 2021

Refactored all our current jet code to use this detection, everything working smoothly, functions are now specific yet lean and many less points of failure, this is the reason I wanted to use this library, glad I can finally use it as intended. Working great!

@go-jet
Copy link
Owner

go-jet commented Dec 8, 2021

Cool! Glad to hear that.

@CmpHDL CmpHDL closed this as completed Dec 10, 2021
@CmpHDL
Copy link
Author

CmpHDL commented Feb 1, 2023

@go-jet Getting reflect: slice index out of range again. It apparently happens when a struct references two types that reference the same type.

type A struct {
    model.As
    B *B
    C *C
}

type B struct {
    model.Bs
    D *D
}

type C struct {
    model.Cs
    D *D
}

When doing a select a.inner_join(b).inner_join(c).inner_join(d) reflect: slice index out of range is returned, probably because its cant determine for some reason where to store D's (either in type B or type C).

@CmpHDL CmpHDL reopened this Feb 1, 2023
@go-jet
Copy link
Owner

go-jet commented Feb 1, 2023

Hi @CmpHDL,
Could you share the stacktrace?

@CmpHDL
Copy link
Author

CmpHDL commented Feb 1, 2023

@go-jet

http: panic serving 172.18.0.1:51564: reflect: slice index out of range
goroutine 38 [running]:
net/http.(*conn).serve.func1()
/usr/local/go/src/net/http/server.go:1801 +0xb9
panic({0x8553c0, 0x9c59a0})
/usr/local/go/src/runtime/panic.go:1047 +0x266
reflect.Value.Index({0x847920, 0xc00023e248, 0xc0000efea0}, 0x85)
/usr/local/go/src/reflect/value.go:1297 +0x178
github.com/go-jet/jet/v2/qrm.getSliceElemPtrAt({0x82c340, 0xc00023e248, 0xc0000efea0}, 0x85)
/go/pkg/mod/github.com/go-jet/jet/v2@v2.9.0/qrm/utill.go:43 +0x32
github.com/go-jet/jet/v2/qrm.mapRowToSlice(0xc00010cf00, {0xc0004a8850, 0x6a}, {0x82c340, 0xc00023e248, 0xc0004cf288}, 0xc0002437a0)
/go/pkg/mod/github.com/go-jet/jet/v2@v2.9.0/qrm/qrm.go:161 +0x3e9
github.com/go-jet/jet/v2/qrm.mapRowToDestinationPtr(0x847920, {0xc0004a8850, 0x6a}, {0x82c340, 0xc00023e248, 0x5}, 0xc0002437a0)
/go/pkg/mod/github.com/go-jet/jet/v2@v2.9.0/qrm/qrm.go:334 +0xcb
github.com/go-jet/jet/v2/qrm.mapRowToDestinationValue(0x8f6360, {0xc0004a8850, 0x6a}, {0x847920, 0xc00023e248, 0x847920}, 0x809ab8)
/go/pkg/mod/github.com/go-jet/jet/v2@v2.9.0/qrm/qrm.go:308 +0x152
github.com/go-jet/jet/v2/qrm.mapRowToStruct(0xc00010cf00, {0xc0004a8850, 0x6a}, {0x8eb600, 0xc00023e160, 0xc0004cf558}, 0x4a925d, {0x0, 0x0, 0x0})
/go/pkg/mod/github.com/go-jet/jet/v2@v2.9.0/qrm/qrm.go:241 +0x5d0
github.com/go-jet/jet/v2/qrm.mapRowToDestinationPtr(0x9e1690, {0xc0004a8850, 0x6a}, {0x8eb600, 0xc00023e160, 0x2}, 0xc0002402a0)
/go/pkg/mod/github.com/go-jet/jet/v2@v2.9.0/qrm/qrm.go:332 +0x114
github.com/go-jet/jet/v2/qrm.mapRowToDestinationValue(0x8d6c80, {0xc0004a8850, 0x6a}, {0x8eb600, 0xc0005a0250, 0x8eb600}, 0x80cb57)
/go/pkg/mod/github.com/go-jet/jet/v2@v2.9.0/qrm/qrm.go:308 +0x152
github.com/go-jet/jet/v2/qrm.mapRowToStruct(0xc00010cf00, {0xc0004a8850, 0x6a}, {0x8dbd40, 0xc0005a01a0, 0xc0004cf8d0}, 0x4a925d, {0x0, 0x0, 0x0})
/go/pkg/mod/github.com/go-jet/jet/v2@v2.9.0/qrm/qrm.go:241 +0x5d0
github.com/go-jet/jet/v2/qrm.mapRowToDestinationPtr(0x9e1690, {0xc0004a8850, 0x6a}, {0x8dbd40, 0xc0005a01a0, 0x2}, 0xc00022eaf0)
/go/pkg/mod/github.com/go-jet/jet/v2@v2.9.0/qrm/qrm.go:332 +0x114
github.com/go-jet/jet/v2/qrm.mapRowToDestinationValue(0x8dc520, {0xc0004a8850, 0x6a}, {0x8dbd40, 0xc0004aab40, 0x8dbd40}, 0x814373)
/go/pkg/mod/github.com/go-jet/jet/v2@v2.9.0/qrm/qrm.go:308 +0x152
github.com/go-jet/jet/v2/qrm.mapRowToStruct(0xc00010cf00, {0xc0004a8850, 0x6a}, {0x8bbb60, 0xc0004aaa80, 0xc0000a1610}, 0x8553c0, {0x0, 0x0, 0x0})
/go/pkg/mod/github.com/go-jet/jet/v2@v2.9.0/qrm/qrm.go:241 +0x5d0
github.com/go-jet/jet/v2/qrm.mapRowToSlice(0xc00010cf00, {0x0, 0x0}, {0x82c3c0, 0xc00012efa8, 0xc0000a12b0}, 0x0)
/go/pkg/mod/github.com/go-jet/jet/v2@v2.9.0/qrm/qrm.go:168 +0x2de
github.com/go-jet/jet/v2/qrm.queryToSlice({0x9d3550, 0xc0000aa000}, {0x9c95c0, 0xc0000a7ee0}, {0xc0001d4400, 0x44f777}, {0xc0000a12b0, 0x0, 0x0}, {0x82c3c0, ...})
/go/pkg/mod/github.com/go-jet/jet/v2@v2.9.0/qrm/qrm.go:124 +0x2ec
github.com/go-jet/jet/v2/qrm.Query({0x9d3550, 0xc0000aa000}, {0x9c95c0, 0xc0000a7ee0}, {0xc0001d4400, 0xb09}, {0xc0000a12b0, 0x1, 0x1}, {0x82c3c0, ...})
/go/pkg/mod/github.com/go-jet/jet/v2@v2.9.0/qrm/qrm.go:29 +0x1bb
github.com/go-jet/jet/v2/internal/jet.(*serializerStatementInterfaceImpl).QueryContext.func1()
/go/pkg/mod/github.com/go-jet/jet/v2@v2.9.0/internal/jet/statement.go:102 +0x65
github.com/go-jet/jet/v2/internal/jet.duration(0xc0004d0050)
/go/pkg/mod/github.com/go-jet/jet/v2@v2.9.0/internal/jet/statement.go:181 +0x37
github.com/go-jet/jet/v2/internal/jet.(*serializerStatementInterfaceImpl).QueryContext(0xc00010ceb0, {0x9d3550, 0xc0000aa000}, {0x9c95c0, 0xc0000a7ee0}, {0x82c3c0, 0xc00012efa8})
/go/pkg/mod/github.com/go-jet/jet/v2@v2.9.0/internal/jet/statement.go:101 +0x1d1
github.com/go-jet/jet/v2/internal/jet.(*serializerStatementInterfaceImpl).Query(0x929120, {0x9c95c0, 0xc0000a7ee0}, {0x82c3c0, 0xc00012efa8})
/go/pkg/mod/github.com/go-jet/jet/v2@v2.9.0/internal/jet/statement.go:90 +0x4a

@CmpHDL
Copy link
Author

CmpHDL commented Feb 1, 2023

Running version
github.com/go-jet/jet/v2 v2.9.0

@houten11
Copy link

houten11 commented Feb 2, 2023

Your destination type looks similar to the type from this discussion.

@CmpHDL
Copy link
Author

CmpHDL commented Feb 2, 2023

Thank you @houten11 This is how I fixed it in the meantime. Although, is there a way we could put an alias on a struct field? Eg:

type A struct {
    model.As
    B *B 
    C *C 
}

type B struct {
    model.Bs
    D *D `alias:b_ds`
}

type C struct {
    model.Cs
    D *D `alias:"c_ds"`
}

type D struct {
    model.Ds
}

That way we would could maintain all of the methods on D without having to duplicate them in another model or have to do some sort of casting?

@CmpHDL
Copy link
Author

CmpHDL commented Feb 2, 2023

Also is there no way to distinguish which should nested struct should go on which automatically?

@houten11
Copy link

houten11 commented Feb 2, 2023

Yeah, you're right. Discussion type is not that similar to your destination type. Your alias example should work, except maybe type D struct. I don't believe alias is propagated to model.Ds in this case. But maybe you can use type D model.Ds instead.

@CmpHDL
Copy link
Author

CmpHDL commented Feb 2, 2023

@houten11 Problem is we would lose all methods on type D

@houten11
Copy link

houten11 commented Feb 3, 2023

No, you can still add methods on the renamed type.

type D model.Ds

func (d D) SomeMethod() {}

@go-jet
Copy link
Owner

go-jet commented Feb 3, 2023

@CmpHDL Could you share the query you used in your first attempt. I can't reproduce the bug.

Just by looking at stacktrace it doesn't' seems to be related to types circular reference.

Also, what driver are you using?

@CmpHDL
Copy link
Author

CmpHDL commented Feb 11, 2023

Postgres, I'll create a reproduction for this so you can reproduce. But I essentially just did inner joins.

@CmpHDL
Copy link
Author

CmpHDL commented Feb 11, 2023

No, you can still add methods on the renamed type.

type D model.Ds

func (d D) SomeMethod() {}

However, then, additional properties cannot be added.

@go-jet
Copy link
Owner

go-jet commented Feb 13, 2023

I'll create a reproduction for this so you can reproduce.

This would be great.

@CmpHDL
Copy link
Author

CmpHDL commented Apr 10, 2023

Forgot about this, always juggling 100 things. I'll make one today if not then this week.

@go-jet
Copy link
Owner

go-jet commented Apr 10, 2023

This seems like a scan grouping bug, so for your test sample you can ignore all the columns except the primary key columns.

@go-jet go-jet modified the milestones: Version 2.7.0, Version 2.10.0 Apr 17, 2023
@go-jet go-jet closed this as completed Apr 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants