Documentation ¶
Index ¶
- Constants
- func DraftTableName(table string) string
- func IsDraftMode(db *gorm.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 Publish
- func (pb *Publish) AutoMigrate(values ...interface{})
- func (publish *Publish) ConfigureQorResource(res resource.Resourcer)
- func (publish *Publish) ConfigureQorResourceBeforeInitialize(res resource.Resourcer)
- func (pb Publish) Discard(records ...interface{})
- func (pb Publish) DraftDB() *gorm.DB
- func (pb Publish) Logger(l LoggerInterface) *Publish
- func (pb Publish) ProductionDB() *gorm.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 ( // 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 *gorm.DB, event PublishEventInterface) error Discard(db *gorm.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 *gorm.DB SearchHandler func(db *gorm.DB, context *qor.Context) *gorm.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) ConfigureQorResource ¶
ConfigureQorResource configure qor resource for qor admin
func (*Publish) ConfigureQorResourceBeforeInitialize ¶
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 { gorm.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 *gorm.DB) error
Discard discard data
func (*PublishEvent) Publish ¶
func (publishEvent *PublishEvent) Publish(db *gorm.DB) error
Publish publish data
func (PublishEvent) VisiblePublishResource ¶
func (PublishEvent) VisiblePublishResource(*qor.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) ConfigureQorResource ¶
ConfigureQorResource configure qor resource for qor admin
func (Status) GetPublishStatus ¶
GetPublishStatus get publish status
func (*Status) SetPublishStatus ¶
SetPublishStatus set publish status