badger

package module
v0.0.0-...-592cec2 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2023 License: LGPL-3.0 Imports: 22 Imported by: 0

README

badger

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthenticatedOnly

func AuthenticatedOnly(next http.Handler) http.Handler

func RenderIndex

func RenderIndex(w http.ResponseWriter, r *http.Request, service *Service)

func RenderNotFound

func RenderNotFound(w http.ResponseWriter, r *http.Request, service *Service)

Types

type Advanced

type Advanced struct {
	OnDiagnostics func(args *DiagnosticsArgs)

	Actions map[string]*PersistentObjectActions
}

func (*Advanced) AddPersistentObjectActions

func (advanced *Advanced) AddPersistentObjectActions(name string, actions PersistentObjectActions)

AddPersistentObjectActions Deprecated

func (*Advanced) GetPersistentObjectActions

func (advanced *Advanced) GetPersistentObjectActions(name string) *PersistentObjectActions

GetPersistentObjectActions Deprecated

func (*Advanced) On

func (advanced *Advanced) On(name string, event any)

type App

type App struct {
	Config   *ini.File
	AppName  string
	Advanced *Advanced
	Models   *ModelDb
	Rules    RuleStore
	Users    user.Store

	// Deprecated
	DB *sqlx.DB
	// contains filtered or unexported fields
}

func Default

func Default() *App

func (*App) IsDevelopment

func (app *App) IsDevelopment() bool

func (*App) Run

func (app *App) Run()

func (*App) UseService

func (app *App) UseService() func(http.Handler) http.Handler

type ConstructArgs

type ConstructArgs struct {
	Service          *Service
	PersistentObject *model.PersistentObject
}

type CustomActionArgs

type CustomActionArgs struct {
	Service *Service
	Object  *model.PersistentObject
	Query   *model.Query
	Ids     []string
}

type CustomActionRunner

type CustomActionRunner struct {
	IsPermitted func(args *PermittedArgs) bool
	OnExecute   func(args *CustomActionArgs) *model.PersistentObject
}

type CustomQueryArgs

type CustomQueryArgs struct {
	Service *Service
	Query   *model.Query
}

type DeleteArgs

type DeleteArgs struct {
	Service *Service
	Ids     []string
}

type DiagnosticsArgs

type DiagnosticsArgs struct {
	Data   map[string]any
	Accept string
}

type LoadArgs

type LoadArgs struct {
	Service          *Service
	PersistentObject *model.PersistentObject
}

type ModelDb

type ModelDb struct {
	*model.Db
	// contains filtered or unexported fields
}

func (*ModelDb) AddCustomActionRunner

func (m *ModelDb) AddCustomActionRunner(name string, impl *CustomActionRunner)

func (*ModelDb) AddQuerySource

func (m *ModelDb) AddQuerySource(name string, source QuerySource)

func (*ModelDb) GetCustomActionRunner

func (m *ModelDb) GetCustomActionRunner(name string) *CustomActionRunner

func (*ModelDb) GetQuerySource

func (m *ModelDb) GetQuerySource(name string) QuerySource

type NewArgs

type NewArgs struct {
	Service          *Service
	PersistentObject *model.PersistentObject
}

type OnConstruct

type OnConstruct func(args *ConstructArgs) error

type OnDelete

type OnDelete func(args *DeleteArgs) error

type OnLoad

type OnLoad func(args *LoadArgs) error

type OnNew

type OnNew func(args *NewArgs) error

type OnQuery

type OnQuery func(args *QueryArgs) error

type OnSave

type OnSave func(args *SaveArgs) error

type PermittedArgs

type PermittedArgs struct {
	Service *Service
	Object  *model.PersistentObject
	Query   *model.ExecutedQuery
}

type PersistentObjectActions

type PersistentObjectActions struct {
	OnConstruct
	OnNew
	OnLoad
	OnSave
	OnQuery
	OnDelete
}

type PostgresBackend

type PostgresBackend struct {
	// contains filtered or unexported fields
}

func (*PostgresBackend) ExecuteQuery

func (backend *PostgresBackend) ExecuteQuery(query *model.Query, sourceResult any, options service.ExecuteQueryOptions) (*model.QueryResult, error)

func (*PostgresBackend) GetPersistentObject

func (backend *PostgresBackend) GetPersistentObject(obj *model.PersistentObject, id string) error

type QueryArgs

type QueryArgs struct {
	Service *Service
	Query   *model.ExecutedQuery
}

type QuerySource

type QuerySource func(args *CustomQueryArgs) any

type RuleArgs

type RuleArgs struct {
	Service   *Service
	Attribute *model.Attribute
}

type RuleStore

type RuleStore map[string]func(args *RuleArgs) string

type SaveArgs

type SaveArgs struct {
	Service          *Service
	PersistentObject *model.PersistentObject
}

type Service

type Service struct {
	App    *App
	Query  *model.ExecutedQuery
	Object *model.PersistentObject //TODO: Rename to PersistentObject
	Nav    *model.Nav
	Html   template.HTML
	User   *user.User
	// contains filtered or unexported fields
}

func (*Service) ExecuteQuery

func (service *Service) ExecuteQuery(query *model.Query, options service.ExecuteQueryOptions) (*model.ExecutedQuery, error)

ExecuteQuery TODO: page should go into something like "ExecuteQueryOptions"

func (*Service) GetPersistentObject

func (service *Service) GetPersistentObject(name string, id string) (*model.PersistentObject, error)

Directories

Path Synopsis
examples

Jump to

Keyboard shortcuts

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