Documentation
¶
Overview ¶
Code generated by github.com/dashotv/golem. DO NOT EDIT.
Code generated by github.com/dashotv/golem. DO NOT EDIT.
Code generated by github.com/dashotv/golem. DO NOT EDIT.
Code generated by github.com/dashotv/golem. DO NOT EDIT.
Index ¶
- func ContextSet(ctx context.Context, key string, value interface{}) context.Context
- func Setup() error
- func Start() error
- func TickTock(tag string) func()
- func WithTimeout(delegate func() interface{}, timeout time.Duration) (ret interface{}, ok bool)
- type Application
- func (a *Application) FileCreate(c echo.Context, subject *File) error
- func (a *Application) FileCreateHandler(c echo.Context) error
- func (a *Application) FileDelete(c echo.Context, id string) error
- func (a *Application) FileDeleteHandler(c echo.Context) error
- func (a *Application) FileIndex(c echo.Context, page int, limit int) error
- func (a *Application) FileIndexHandler(c echo.Context) error
- func (a *Application) FileSettings(c echo.Context, id string, setting *Setting) error
- func (a *Application) FileSettingsHandler(c echo.Context) error
- func (a *Application) FileShow(c echo.Context, id string) error
- func (a *Application) FileShowHandler(c echo.Context) error
- func (a *Application) FileUpdate(c echo.Context, id string, subject *File) error
- func (a *Application) FileUpdateHandler(c echo.Context) error
- func (a *Application) Health() (map[string]bool, error)
- func (a *Application) LibraryCreate(c echo.Context, subject *Library) error
- func (a *Application) LibraryCreateHandler(c echo.Context) error
- func (a *Application) LibraryDelete(c echo.Context, id string) error
- func (a *Application) LibraryDeleteHandler(c echo.Context) error
- func (a *Application) LibraryIndex(c echo.Context, page int, limit int) error
- func (a *Application) LibraryIndexHandler(c echo.Context) error
- func (a *Application) LibrarySettings(c echo.Context, id string, setting *Setting) error
- func (a *Application) LibrarySettingsHandler(c echo.Context) error
- func (a *Application) LibraryShow(c echo.Context, id string) error
- func (a *Application) LibraryShowHandler(c echo.Context) error
- func (a *Application) LibraryTemplateCreate(c echo.Context, subject *LibraryTemplate) error
- func (a *Application) LibraryTemplateCreateHandler(c echo.Context) error
- func (a *Application) LibraryTemplateDelete(c echo.Context, id string) error
- func (a *Application) LibraryTemplateDeleteHandler(c echo.Context) error
- func (a *Application) LibraryTemplateIndex(c echo.Context, page int, limit int) error
- func (a *Application) LibraryTemplateIndexHandler(c echo.Context) error
- func (a *Application) LibraryTemplateSettings(c echo.Context, id string, setting *Setting) error
- func (a *Application) LibraryTemplateSettingsHandler(c echo.Context) error
- func (a *Application) LibraryTemplateShow(c echo.Context, id string) error
- func (a *Application) LibraryTemplateShowHandler(c echo.Context) error
- func (a *Application) LibraryTemplateUpdate(c echo.Context, id string, subject *LibraryTemplate) error
- func (a *Application) LibraryTemplateUpdateHandler(c echo.Context) error
- func (a *Application) LibraryTypeCreate(c echo.Context, subject *LibraryType) error
- func (a *Application) LibraryTypeCreateHandler(c echo.Context) error
- func (a *Application) LibraryTypeDelete(c echo.Context, id string) error
- func (a *Application) LibraryTypeDeleteHandler(c echo.Context) error
- func (a *Application) LibraryTypeIndex(c echo.Context, page int, limit int) error
- func (a *Application) LibraryTypeIndexHandler(c echo.Context) error
- func (a *Application) LibraryTypeSettings(c echo.Context, id string, setting *Setting) error
- func (a *Application) LibraryTypeSettingsHandler(c echo.Context) error
- func (a *Application) LibraryTypeShow(c echo.Context, id string) error
- func (a *Application) LibraryTypeShowHandler(c echo.Context) error
- func (a *Application) LibraryTypeUpdate(c echo.Context, id string, subject *LibraryType) error
- func (a *Application) LibraryTypeUpdateHandler(c echo.Context) error
- func (a *Application) LibraryUpdate(c echo.Context, id string, subject *Library) error
- func (a *Application) LibraryUpdateHandler(c echo.Context) error
- func (a *Application) Routes()
- type Config
- type Connection
- type ConnectionSet
- type Connector
- func (c *Connector) FileCreateOrUpdate(path string) (*File, error)
- func (c *Connector) FileGet(id string) (*File, error)
- func (c *Connector) FileList(page, limit int) ([]*File, error)
- func (c *Connector) LibraryGet(id string) (*Library, error)
- func (c *Connector) LibraryGetByKind(kind string) (*Library, error)
- func (c *Connector) LibraryList(page, limit int) ([]*Library, error)
- func (c *Connector) LibraryTemplateGet(id string) (*LibraryTemplate, error)
- func (c *Connector) LibraryTemplateList(page, limit int) ([]*LibraryTemplate, error)
- func (c *Connector) LibraryTypeGet(id string) (*LibraryType, error)
- func (c *Connector) LibraryTypeList(page, limit int) ([]*LibraryType, error)
- type File
- type Library
- type LibraryFiles
- type LibraryFilesAll
- type LibraryTemplate
- type LibraryType
- type PlexFiles
- type Response
- type Setting
- type SettingsBatch
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContextSet ¶
func WithTimeout ¶
WithTimeout runs a delegate function with a timeout,
Example: Wait for a channel
if value, ok := WithTimeout(func()interface{}{return <- inbox}, time.Second); ok {
// returned
} else {
// didn't return
}
Example: To send to a channel
_, ok := WithTimeout(func()interface{}{outbox <- myValue; return nil}, time.Second)
if !ok {
// didn't send
}
Types ¶
type Application ¶
type Application struct {
Config *Config
Log *zap.SugaredLogger
//golem:template:app/app_partial_definitions
// DO NOT EDIT. This section is managed by github.com/dashotv/golem.
// Routes
Engine *echo.Echo
Default *echo.Group
Router *echo.Group
// Models
DB *Connector
// Workers
Workers *minion.Minion
Plex *plexgo.PlexAPI
}
func ContextApp ¶
func ContextApp(ctx context.Context) *Application
func (*Application) FileCreate ¶
func (a *Application) FileCreate(c echo.Context, subject *File) error
POST /file/
func (*Application) FileCreateHandler ¶
func (a *Application) FileCreateHandler(c echo.Context) error
func (*Application) FileDelete ¶
func (a *Application) FileDelete(c echo.Context, id string) error
DELETE /file/:id
func (*Application) FileDeleteHandler ¶
func (a *Application) FileDeleteHandler(c echo.Context) error
func (*Application) FileIndexHandler ¶
func (a *Application) FileIndexHandler(c echo.Context) error
File (/file)
func (*Application) FileSettings ¶
PATCH /file/:id
func (*Application) FileSettingsHandler ¶
func (a *Application) FileSettingsHandler(c echo.Context) error
func (*Application) FileShow ¶
func (a *Application) FileShow(c echo.Context, id string) error
GET /file/:id
func (*Application) FileShowHandler ¶
func (a *Application) FileShowHandler(c echo.Context) error
func (*Application) FileUpdate ¶
PUT /file/:id
func (*Application) FileUpdateHandler ¶
func (a *Application) FileUpdateHandler(c echo.Context) error
func (*Application) LibraryCreate ¶
func (a *Application) LibraryCreate(c echo.Context, subject *Library) error
POST /library/
func (*Application) LibraryCreateHandler ¶
func (a *Application) LibraryCreateHandler(c echo.Context) error
func (*Application) LibraryDelete ¶
func (a *Application) LibraryDelete(c echo.Context, id string) error
DELETE /library/:id
func (*Application) LibraryDeleteHandler ¶
func (a *Application) LibraryDeleteHandler(c echo.Context) error
func (*Application) LibraryIndex ¶
GET /library/
func (*Application) LibraryIndexHandler ¶
func (a *Application) LibraryIndexHandler(c echo.Context) error
Library (/library)
func (*Application) LibrarySettings ¶
PATCH /library/:id
func (*Application) LibrarySettingsHandler ¶
func (a *Application) LibrarySettingsHandler(c echo.Context) error
func (*Application) LibraryShow ¶
func (a *Application) LibraryShow(c echo.Context, id string) error
GET /library/:id
func (*Application) LibraryShowHandler ¶
func (a *Application) LibraryShowHandler(c echo.Context) error
func (*Application) LibraryTemplateCreate ¶
func (a *Application) LibraryTemplateCreate(c echo.Context, subject *LibraryTemplate) error
POST /library_template/
func (*Application) LibraryTemplateCreateHandler ¶
func (a *Application) LibraryTemplateCreateHandler(c echo.Context) error
func (*Application) LibraryTemplateDelete ¶
func (a *Application) LibraryTemplateDelete(c echo.Context, id string) error
DELETE /library_template/:id
func (*Application) LibraryTemplateDeleteHandler ¶
func (a *Application) LibraryTemplateDeleteHandler(c echo.Context) error
func (*Application) LibraryTemplateIndex ¶
GET /library_template/
func (*Application) LibraryTemplateIndexHandler ¶
func (a *Application) LibraryTemplateIndexHandler(c echo.Context) error
LibraryTemplate (/library_template)
func (*Application) LibraryTemplateSettings ¶
PATCH /library_template/:id
func (*Application) LibraryTemplateSettingsHandler ¶
func (a *Application) LibraryTemplateSettingsHandler(c echo.Context) error
func (*Application) LibraryTemplateShow ¶
func (a *Application) LibraryTemplateShow(c echo.Context, id string) error
GET /library_template/:id
func (*Application) LibraryTemplateShowHandler ¶
func (a *Application) LibraryTemplateShowHandler(c echo.Context) error
func (*Application) LibraryTemplateUpdate ¶
func (a *Application) LibraryTemplateUpdate(c echo.Context, id string, subject *LibraryTemplate) error
PUT /library_template/:id
func (*Application) LibraryTemplateUpdateHandler ¶
func (a *Application) LibraryTemplateUpdateHandler(c echo.Context) error
func (*Application) LibraryTypeCreate ¶
func (a *Application) LibraryTypeCreate(c echo.Context, subject *LibraryType) error
POST /library_type/
func (*Application) LibraryTypeCreateHandler ¶
func (a *Application) LibraryTypeCreateHandler(c echo.Context) error
func (*Application) LibraryTypeDelete ¶
func (a *Application) LibraryTypeDelete(c echo.Context, id string) error
DELETE /library_type/:id
func (*Application) LibraryTypeDeleteHandler ¶
func (a *Application) LibraryTypeDeleteHandler(c echo.Context) error
func (*Application) LibraryTypeIndex ¶
GET /library_type/
func (*Application) LibraryTypeIndexHandler ¶
func (a *Application) LibraryTypeIndexHandler(c echo.Context) error
LibraryType (/library_type)
func (*Application) LibraryTypeSettings ¶
PATCH /library_type/:id
func (*Application) LibraryTypeSettingsHandler ¶
func (a *Application) LibraryTypeSettingsHandler(c echo.Context) error
func (*Application) LibraryTypeShow ¶
func (a *Application) LibraryTypeShow(c echo.Context, id string) error
GET /library_type/:id
func (*Application) LibraryTypeShowHandler ¶
func (a *Application) LibraryTypeShowHandler(c echo.Context) error
func (*Application) LibraryTypeUpdate ¶
func (a *Application) LibraryTypeUpdate(c echo.Context, id string, subject *LibraryType) error
PUT /library_type/:id
func (*Application) LibraryTypeUpdateHandler ¶
func (a *Application) LibraryTypeUpdateHandler(c echo.Context) error
func (*Application) LibraryUpdate ¶
PUT /library/:id
func (*Application) LibraryUpdateHandler ¶
func (a *Application) LibraryUpdateHandler(c echo.Context) error
func (*Application) Routes ¶
func (a *Application) Routes()
type Config ¶
type Config struct {
Mode string `env:"MODE" envDefault:"dev"`
Logger string `env:"LOGGER" envDefault:"dev"`
Port int `env:"PORT" envDefault:"10080"`
//golem:template:app/config_partial_struct
// DO NOT EDIT. This section is managed by github.com/dashotv/golem.
// Models (Database)
Connections ConnectionSet `env:"CONNECTIONS,required"`
// Router Auth
Auth bool `env:"AUTH" envDefault:"false"`
ClerkSecretKey string `env:"CLERK_SECRET_KEY"`
ClerkToken string `env:"CLERK_TOKEN"`
// Workers
MinionConcurrency int `env:"MINION_CONCURRENCY" envDefault:"10"`
MinionDebug bool `env:"MINION_DEBUG" envDefault:"false"`
MinionBufferSize int `env:"MINION_BUFFER_SIZE" envDefault:"100"`
MinionURI string `env:"MINION_URI,required"`
MinionDatabase string `env:"MINION_DATABASE,required"`
MinionCollection string `env:"MINION_COLLECTION,required"`
PlexToken string `env:"PLEX_TOKEN"`
PlexURL string `env:"PLEX_URL"`
PlexIdentifier string `env:"PLEX_IDENTIFIER"`
WatcherDirectories []string `env:"WATCHER_DIRECTORIES" envSeparator:","`
}
func (*Config) ConnectionFor ¶
func (c *Config) ConnectionFor(name string) (*Connection, error)
type Connection ¶
type Connection struct {
URI string `yaml:"uri,omitempty"`
Database string `yaml:"database,omitempty"`
Collection string `yaml:"collection,omitempty"`
}
func (*Connection) UnmarshalText ¶
func (c *Connection) UnmarshalText(text []byte) error
type ConnectionSet ¶
type ConnectionSet map[string]*Connection
func (*ConnectionSet) UnmarshalText ¶
func (c *ConnectionSet) UnmarshalText(text []byte) error
type Connector ¶
type Connector struct {
Log *zap.SugaredLogger
File *grimoire.Store[*File]
Library *grimoire.Store[*Library]
LibraryTemplate *grimoire.Store[*LibraryTemplate]
LibraryType *grimoire.Store[*LibraryType]
}
func NewConnector ¶
func NewConnector(app *Application) (*Connector, error)
func (*Connector) FileCreateOrUpdate ¶
func (*Connector) LibraryGetByKind ¶
func (*Connector) LibraryList ¶
func (*Connector) LibraryTemplateGet ¶
func (c *Connector) LibraryTemplateGet(id string) (*LibraryTemplate, error)
func (*Connector) LibraryTemplateList ¶
func (c *Connector) LibraryTemplateList(page, limit int) ([]*LibraryTemplate, error)
func (*Connector) LibraryTypeGet ¶
func (c *Connector) LibraryTypeGet(id string) (*LibraryType, error)
func (*Connector) LibraryTypeList ¶
func (c *Connector) LibraryTypeList(page, limit int) ([]*LibraryType, error)
type File ¶
type File struct {
grimoire.Document `bson:",inline"` // includes default model settings
//ID primitive.ObjectID `bson:"_id,omitempty" json:"id"`
//CreatedAt time.Time `bson:"created_at" json:"created_at"`
//UpdatedAt time.Time `bson:"updated_at" json:"updated_at"`
Type string `bson:"type" json:"type" grimoire:"index"`
Path string `bson:"path" json:"path" grimoire:"index"`
Size int64 `bson:"size" json:"size"`
ModifiedAt int64 `bson:"modified_at" json:"modified_at"`
MediumID primitive.ObjectID `bson:"medium_id" json:"medium_id" grimoire:"index"`
}
type Library ¶
type Library struct {
grimoire.Document `bson:",inline"` // includes default model settings
//ID primitive.ObjectID `bson:"_id,omitempty" json:"id"`
//CreatedAt time.Time `bson:"created_at" json:"created_at"`
//UpdatedAt time.Time `bson:"updated_at" json:"updated_at"`
Name string `bson:"name" json:"name" grimoire:"index"`
Path string `bson:"path" json:"path" grimoire:"index"`
LibraryTypeID primitive.ObjectID `bson:"library_type_id" json:"library_type_id"`
LibraryTemplateID primitive.ObjectID `bson:"library_template_id" json:"library_template_id"`
LibraryType *LibraryType `bson:"-" json:"library_type"`
LibraryTemplate *LibraryTemplate `bson:"-" json:"library_template"`
}
type LibraryFiles ¶
type LibraryFiles struct {
minion.WorkerDefaults[*LibraryFiles]
ID string `bson:"id" json:"id"`
}
func (*LibraryFiles) Kind ¶
func (j *LibraryFiles) Kind() string
func (*LibraryFiles) Work ¶
func (j *LibraryFiles) Work(ctx context.Context, job *minion.Job[*LibraryFiles]) error
type LibraryFilesAll ¶
type LibraryFilesAll struct {
minion.WorkerDefaults[*LibraryFilesAll]
}
func (*LibraryFilesAll) Kind ¶
func (j *LibraryFilesAll) Kind() string
func (*LibraryFilesAll) Work ¶
func (j *LibraryFilesAll) Work(ctx context.Context, job *minion.Job[*LibraryFilesAll]) error
type LibraryTemplate ¶
type LibraryTemplate struct {
grimoire.Document `bson:",inline"` // includes default model settings
//ID primitive.ObjectID `bson:"_id,omitempty" json:"id"`
//CreatedAt time.Time `bson:"created_at" json:"created_at"`
//UpdatedAt time.Time `bson:"updated_at" json:"updated_at"`
Name string `bson:"name" json:"name"`
Template string `bson:"template" json:"template"`
}
type LibraryType ¶
type LibraryType struct {
grimoire.Document `bson:",inline"` // includes default model settings
//ID primitive.ObjectID `bson:"_id,omitempty" json:"id"`
//CreatedAt time.Time `bson:"created_at" json:"created_at"`
//UpdatedAt time.Time `bson:"updated_at" json:"updated_at"`
Name string `bson:"name" json:"name"`
}
type PlexFiles ¶
type PlexFiles struct {
minion.WorkerDefaults[*PlexFiles]
ID string `bson:"id" json:"id"`
}
type SettingsBatch ¶
Source Files
¶
- app.go
- app_context.go
- config.go
- logger.go
- models.gen.go
- models_file.go
- models_library.go
- models_library_template.go
- models_library_type.go
- plex.go
- routes.gen.go
- routes_file.go
- routes_library.go
- routes_library_template.go
- routes_library_type.go
- utils.go
- walker.go
- watcher.go
- workers.gen.go
- workers_library.go
- workers_plex.go