Documentation ¶
Index ¶
- Constants
- func DraftTableName(table string) string
- func IsDraftMode(db *aorm.DB) bool
- func IsPublishEvent(model interface{}) (ok bool)
- func IsPublishableModel(model interface{}) (ok bool)
- func OriginalTableName(table string) string
- func RegisterEvent(name string, event EventInterface)
- type EventInterface
- type LoggerInterface
- type Plugin
- type Publish
- func (pb *Publish) AutoMigrate(values ...interface{})
- func (publish *Publish) ConfigureResource(res resource.Resourcer)
- func (publish *Publish) ConfigureResourceBeforeInitialize(res resource.Resourcer)
- func (pb Publish) Discard(records ...interface{})
- func (pb Publish) DraftDB() *aorm.DB
- func (pb Publish) Logger(l LoggerInterface) *Publish
- func (pb Publish) ProductionDB() *aorm.DB
- func (pb Publish) Publish(records ...interface{})
- func (publish *Publish) SetWorker(w *worker.Worker)
- type PublishEvent
- type PublishEventInterface
- type QorWorkerArgument
- type Status
Constants ¶
const ( // PUBLISHED publish status published PUBLISHED = false // DIRTY publish status dirty DIRTY = true )
const DISCARD_KEY = "qor:publish.discard"
const PUBLISH_KEY = "qor:publish.publish"
const ( // PublishPermission publish permission PublishPermission roles.PermissionMode = "publish" )
Variables ¶
This section is empty.
Functions ¶
func DraftTableName ¶
DraftTableName get draft table name of passed in string
func IsPublishEvent ¶
func IsPublishEvent(model interface{}) (ok bool)
IsPublishEvent check if current model is a publish event model
func IsPublishableModel ¶
func IsPublishableModel(model interface{}) (ok bool)
IsPublishableModel check if current model is a publishable
func OriginalTableName ¶
OriginalTableName get original table name of passed in string
func RegisterEvent ¶
func RegisterEvent(name string, event EventInterface)
RegisterEvent register publish event
Types ¶
type EventInterface ¶
type EventInterface interface { Publish(db *aorm.DB, event PublishEventInterface) error Discard(db *aorm.DB, event PublishEventInterface) error }
EventInterface defined methods needs for a publish event
type LoggerInterface ¶
type LoggerInterface interface {
Print(...interface{})
}
LoggerInterface logger interface used to print publish logs
var Logger LoggerInterface
Logger default logger used to print publish logs
type Publish ¶
type Publish struct { DB *aorm.DB SearchHandler func(db *aorm.DB, context *core.Context) *aorm.DB WorkerScheduler *worker.Worker // contains filtered or unexported fields }
Publish defined a publish struct
func (*Publish) AutoMigrate ¶
func (pb *Publish) AutoMigrate(values ...interface{})
AutoMigrate run auto migrate in draft tables
func (*Publish) ConfigureResource ¶
ConfigureQorResource configure qor resource for qor admin
func (*Publish) ConfigureResourceBeforeInitialize ¶
ConfigureQorResourceBeforeInitialize configure qor resource when initialize qor admin
func (Publish) Logger ¶
func (pb Publish) Logger(l LoggerInterface) *Publish
Logger set logger that used to print publish logs
func (Publish) ProductionDB ¶
ProductionDB get db in production mode
type PublishEvent ¶
type PublishEvent struct { aorm.Model Name string Description string Argument string `sql:"size:65532"` PublishStatus bool PublishedBy string }
PublishEvent default publish event model
func (*PublishEvent) Discard ¶
func (publishEvent *PublishEvent) Discard(db *aorm.DB) error
Discard discard data
func (*PublishEvent) Publish ¶
func (publishEvent *PublishEvent) Publish(db *aorm.DB) error
Publish publish data
func (PublishEvent) VisiblePublishResource ¶
func (PublishEvent) VisiblePublishResource(*core.Context) bool
VisiblePublishResource force to display publish event in publish drafts even it is hidden in the menus
type PublishEventInterface ¶
PublishEventInterface defined publish event itself's interface
type QorWorkerArgument ¶
QorWorkerArgument used for qor publish job's argument
type Status ¶
type Status struct {
PublishStatus bool
}
Status publish status, need to be embedded in your models to get the publish feature
func (*Status) ConfigureResource ¶
ConfigureQorResource configure qor resource for qor admin
func (*Status) GetPublishStatus ¶
GetPublishStatus get publish status
func (*Status) SetPublishStatus ¶
SetPublishStatus set publish status