Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Admin ¶
type Admin struct { // Title allows you to set a custom title for the admin panel. Default is "Admin". Title string // NameTransform is optional, and allows you to set a function that model names and field names are sent through // to maintain compatibility with an ORM. For example, Beego ORM saves tables/columns in snake_case, while CamelCase // is used in Go. NameTransform NameTransformFunc // contains filtered or unexported fields }
func New ¶
New sets up the admin with a "path" prefix (typically /admin) and the name of a database driver and source.
func NewFromConnection ¶
NewFromConnection sets up the admin with a "path" prefix (typically /admin) and connection of a database
func (*Admin) Group ¶
Group adds a model group to the admin front page. Use this to organize your models.
func (*Admin) Handler ¶
Handler returns a http.Handler that you can attach to any mux to serve the admin.
func (*Admin) SourceDir ¶
SourceDir allows you to override the location in which templates and static content is looked for / served from. If not set, it defaults to $GOPATH/src/github.com/oal/admin. You may also copy "templates" and "static" from there, into your own project, and change SourceDir accordingly.
type NameTransformFunc ¶
NameTransformFunc is a function that takes the name of a Go struct field and outputs another version of itself. This is used to be compatible with various ORMs. See NameTransform on the Admin struct.
type NamedModel ¶
type NamedModel interface {
AdminName() string
}
NamedModel requires an AdminName method to be present, to override the model's displayed name in the admin panel.
type SortedModel ¶
type SortedModel interface {
SortBy() string
}