Set up QOR admin

QOR Admin is the foundation of QOR. All Resources are created based on it (note: in the next chapter, we will introduce the Resource).

QOR Admin's User Interface (UI) and User Experience (UX) heavily draws on Google's Material Design language, we have pushed the envelope in some aspects and hope you like the result! That said, when extending QOR Admin for your own needs, you can leverage the Material Design specification to aid in achieving a seamless UI and UX.

1. Prepare database

The official ORM that QOR uses is GORM. We use it in the demo code too.

Define models and setup a database...

type User struct {
  gorm.Model
  Email     string
  Password  string
  Name      sql.NullString
  Gender    string
  Role      string
  Addresses []Address
}

DB, _ := gorm.Open("sqlite3", "demo.db")
DB.AutoMigrate(&User{})

2. Initialise QOR Admin

The qor.Config takes the database as its only parameter.

import {
  "github.com/qor/admin"
  "github.com/qor/qor"
}

Admin := admin.New(&qor.Config{DB: DB})

3. General settings

Now the QOR Admin is initialized. Next you can customize the Dashboard, Set Site name, Configure Menus and Router. Then go to next chapter to learn more about the Resources.

results matching ""

    No results matching ""