Document System Tutorial Part 2 - Creating and Registering a Model (Current Progress)¶
Structure:
models¶
folder.go¶
package models
import (
"github.com/uadmin/uadmin"
)
// Folder !
type Folder struct {
uadmin.Model
Name string
Parent *Folder
ParentID uint
}
main.go¶
package main
import (
// Specify the username that you used inside github.com folder
"github.com/username/document_system/models"
"github.com/uadmin/uadmin"
)
func main() {
// Register models to uAdmin
uadmin.Register(
models.Folder{},
)
// Assign Site Name value as "Document System"
// NOTE: This code works only if database does not exist yet.
uadmin.SiteName = "Document System"
// Activates a uAdmin server
uadmin.StartServer()
}