adsa-cms: Index | Files

package publish

import ""


Package Files

callbacks.go controller.go event.go logger.go many_2_many.go publish.go resolver.go worker.go


const (
    // PUBLISHED publish status published
    PUBLISHED = false
    // DIRTY publish status dirty
    DIRTY = true
const (
    // PublishPermission publish permission
    PublishPermission roles.PermissionMode = "publish"

func DraftTableName Uses

func DraftTableName(table string) string

DraftTableName get draft table name of passed in string

func IsDraftMode Uses

func IsDraftMode(db *gorm.DB) bool

IsDraftMode check if current db in draft mode

func IsPublishEvent Uses

func IsPublishEvent(model interface{}) (ok bool)

IsPublishEvent check if current model is a publish event model

func IsPublishableModel Uses

func IsPublishableModel(model interface{}) (ok bool)

IsPublishableModel check if current model is a publishable

func OriginalTableName Uses

func OriginalTableName(table string) string

OriginalTableName get original table name of passed in string

func RegisterEvent Uses

func RegisterEvent(name string, event EventInterface)

RegisterEvent register publish event

type EventInterface Uses

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 Uses

type LoggerInterface interface {

LoggerInterface logger interface used to print publish logs

var Logger LoggerInterface

Logger default logger used to print publish logs

type Publish Uses

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 New Uses

func New(db *gorm.DB) *Publish

New initialize a publish instance

func (*Publish) AutoMigrate Uses

func (pb *Publish) AutoMigrate(values ...interface{})

AutoMigrate run auto migrate in draft tables

func (*Publish) ConfigureQorResource Uses

func (publish *Publish) ConfigureQorResource(res resource.Resourcer)

ConfigureQorResource configure qor resource for qor admin

func (*Publish) ConfigureQorResourceBeforeInitialize Uses

func (publish *Publish) ConfigureQorResourceBeforeInitialize(res resource.Resourcer)

ConfigureQorResourceBeforeInitialize configure qor resource when initialize qor admin

func (Publish) Discard Uses

func (pb Publish) Discard(records ...interface{})

Discard discard records

func (Publish) DraftDB Uses

func (pb Publish) DraftDB() *gorm.DB

DraftDB get db in draft mode

func (Publish) Logger Uses

func (pb Publish) Logger(l LoggerInterface) *Publish

Logger set logger that used to print publish logs

func (Publish) ProductionDB Uses

func (pb Publish) ProductionDB() *gorm.DB

ProductionDB get db in production mode

func (Publish) Publish Uses

func (pb Publish) Publish(records ...interface{})

Publish publish records

func (*Publish) SetWorker Uses

func (publish *Publish) SetWorker(w *worker.Worker)

SetWorker set publish's worker

type PublishEvent Uses

type PublishEvent struct {
    Name          string
    Description   string
    Argument      string `sql:"size:65532"`
    PublishStatus bool
    PublishedBy   string

PublishEvent default publish event model

func (*PublishEvent) Discard Uses

func (publishEvent *PublishEvent) Discard(db *gorm.DB) error

Discard discard data

func (*PublishEvent) Publish Uses

func (publishEvent *PublishEvent) Publish(db *gorm.DB) error

Publish publish data

func (PublishEvent) VisiblePublishResource Uses

func (PublishEvent) VisiblePublishResource(*qor.Context) bool

VisiblePublishResource force to display publish event in publish drafts even it is hidden in the menus

type PublishEventInterface Uses

type PublishEventInterface interface {
    Publish(*gorm.DB) error
    Discard(*gorm.DB) error

PublishEventInterface defined publish event itself's interface

type QorWorkerArgument Uses

type QorWorkerArgument struct {
    IDs []string

QorWorkerArgument used for qor publish job's argument

type Status Uses

type Status struct {
    PublishStatus bool

Status publish status, need to be embedded in your models to get the publish feature

func (Status) ConfigureQorResource Uses

func (s Status) ConfigureQorResource(res resource.Resourcer)

ConfigureQorResource configure qor resource for qor admin

func (Status) GetPublishStatus Uses

func (s Status) GetPublishStatus() bool

GetPublishStatus get publish status

func (*Status) SetPublishStatus Uses

func (s *Status) SetPublishStatus(status bool)

SetPublishStatus set publish status

Package publish imports 16 packages (graph) and is imported by 6 packages. Updated 2017-06-08. Refresh now. Tools for package owners.