models

package
v1.0.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 24, 2023 License: BSD-1-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AdminURLs

type AdminURLs struct {
	// The URL for the admin site.
	AdminSite string
	// AppName is the name of the app the model belongs to.
	AppName string
	// The URL for the list/group name view of the model.
	GroupPart string
	// The URL for the create view of the model.
	Create string
	// The URL for the detail view of the model.
	Detail string
	// The URL for the delete view of the model.
	Delete string
}

This URL is not usable, and is used to generate the actual absolute URL of the model.

func (*AdminURLs) AppURL

func (a *AdminURLs) AppURL() string

The app url where the model is registered.

func (*AdminURLs) CreateURL

func (a *AdminURLs) CreateURL() string

The create url where you can create an instance of the model.

func (*AdminURLs) DeleteURL

func (a *AdminURLs) DeleteURL(id any) string

The delete url where you can delete the model.

func (*AdminURLs) DetailURL

func (a *AdminURLs) DetailURL(id any) string

The detail url where you can view/edit the model.

func (*AdminURLs) GroupURL

func (a *AdminURLs) GroupURL() string

The group url where the model is registered.

type Model

type Model struct {
	// The name of the model.
	Name string
	// The URL for the model.
	URLS *AdminURLs
	// The model itself.
	Mdl any
	// List of fields to display in the admin.
	// Fields []*Field
	Permissions auth.PermissionMap
}

func NewModel

func NewModel(base_url string, m any, permsDB *gorm.DB) (*Model, error)

func (*Model) AppName

func (m *Model) AppName() string

func (*Model) Models

func (m *Model) Models(db *gorm.DB, editQuery ...func(tx *gorm.DB) *gorm.DB) []any

func (*Model) New

func (m *Model) New() any

func (*Model) NewSlice

func (m *Model) NewSlice() any

func (*Model) URL

func (m *Model) URL() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL