From 6119748f101a5677ca8c680b2448336a748a8259 Mon Sep 17 00:00:00 2001
From: Chen Xiongjie <chen.xcmail@gmail.com>
Date: Sat, 4 Dec 2021 11:54:09 +0100
Subject: [PATCH] allow max 512 columns instead of 256 in level of struct

---
 queries/reflect.go | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/queries/reflect.go b/queries/reflect.go
index fa0cf24de..819ef29b1 100644
--- a/queries/reflect.go
+++ b/queries/reflect.go
@@ -31,7 +31,7 @@ const (
 	loadMethodPrefix       = "Load"
 	relationshipStructName = "R"
 	loaderStructName       = "L"
-	sentinel               = uint64(255)
+	sentinel               = uint64(511)
 )
 
 // BindP executes the query and inserts the
@@ -330,8 +330,8 @@ func ptrFromMapping(val reflect.Value, mapping uint64, addressOf bool) reflect.V
 		var ignored interface{}
 		return reflect.ValueOf(&ignored)
 	}
-	for i := 0; i < 8; i++ {
-		v := (mapping >> uint(i*8)) & sentinel
+	for i := 0; i < 9; i++ {
+		v := (mapping >> uint(i*9)) & sentinel
 
 		if v == sentinel {
 			if addressOf && val.Kind() != reflect.Ptr {
@@ -380,11 +380,11 @@ func makeStructMappingHelper(typ reflect.Type, prefix string, current uint64, de
 		}
 
 		if recurse {
-			makeStructMappingHelper(f.Type, tag, current|uint64(i)<<depth, depth+8, fieldMaps)
+			makeStructMappingHelper(f.Type, tag, current|uint64(i)<<depth, depth+9, fieldMaps)
 			continue
 		}
 
-		fieldMaps[tag] = current | (sentinel << (depth + 8)) | (uint64(i) << depth)
+		fieldMaps[tag] = current | (sentinel << (depth + 9)) | (uint64(i) << depth)
 	}
 }