This commit is contained in:
@@ -13,14 +13,14 @@ type Parser struct {
|
||||
Table *Table
|
||||
}
|
||||
|
||||
func NewParser(obj any) *Parser {
|
||||
func NewParser[T any](obj T) *Parser {
|
||||
objType := reflect.TypeOf(obj)
|
||||
return &Parser{typ: objType}
|
||||
}
|
||||
|
||||
// This is step 1 of the parsing, it creates the table instance and
|
||||
func (p *Parser) ParseColumns() *Table {
|
||||
table := Table{Name: camelToSnake(p.typ.Name()), TypeName: p.typ.Name()}
|
||||
table := Table{Name: camelToSnake(p.typ.Name()), Type: p.typ}
|
||||
|
||||
var columns []Column
|
||||
for field := range p.typ.Fields() {
|
||||
|
||||
Reference in New Issue
Block a user