File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -298,6 +298,11 @@ func getTableName(value reflect.Value, typ reflect.Type) string {
298298 return values [0 ]
299299 }
300300 }
301+ if tag := field .Tag .Get ("bun" ); tag != "" {
302+ if values := strings .Split (tag , "," ); len (values ) > 0 {
303+ return values [0 ]
304+ }
305+ }
301306 }
302307 return ToSnakeCase (typ .Name ())
303308 }
@@ -328,6 +333,10 @@ func getColumns(typ reflect.Type) []string {
328333 if ! strings .HasPrefix (tag , "-" ) && field .Name != "tableName" && ! strings .Contains (tag , "rel:" ) {
329334 columns = append (columns , ToSnakeCase (field .Name ))
330335 }
336+ } else if tag := field .Tag .Get ("bun" ); tag != "" {
337+ if ! strings .HasPrefix (tag , "-" ) && field .Name != "BaseModel" && ! strings .Contains (tag , "rel:" ) {
338+ columns = append (columns , ToSnakeCase (field .Name ))
339+ }
331340 } else {
332341 columns = append (columns , ToSnakeCase (field .Name ))
333342 }
You can’t perform that action at this time.
0 commit comments