Initial setup of an admin page that dynamically reflects the DB to create the CRUD stuff.
This commit is contained in:
parent
02910b8b93
commit
859e3ad0e3
6 changed files with 46 additions and 3 deletions
23
tests/admin_test.go
Normal file
23
tests/admin_test.go
Normal file
|
@ -0,0 +1,23 @@
|
|||
package tests
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"fmt"
|
||||
"reflect"
|
||||
"zedshaw.games/webapp/data"
|
||||
// _ "github.com/mattn/go-sqlite3"
|
||||
// "github.com/jmoiron/sqlx"
|
||||
)
|
||||
|
||||
func TestAdminIndexPage(t *testing.T) {
|
||||
models := data.Models()
|
||||
|
||||
for table, model := range models {
|
||||
fmt.Printf("\n------\ntable=%s; model=%s\n", table, model.Name())
|
||||
fields := reflect.VisibleFields(model)
|
||||
|
||||
for _, field := range fields {
|
||||
fmt.Println("\t", field.Name, field.Type, field.Tag)
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue