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 ParseFulltitle(title string) (string, int, int, error)
- func QueryBool(c echo.Context, name string) bool
- func QueryDefaultInteger(c echo.Context, name string, def int) (int, error)
- func QueryInt(c echo.Context, name string) int
- func QueryString(c echo.Context, name string) string
- func Setup() error
- func Start() error
- func WithTimeout(delegate func() interface{}, timeout time.Duration) (ret interface{}, ok bool)
- type Application
- func (a *Application) Health() (map[string]bool, error)
- func (a *Application) PageCreate(c echo.Context, req *Page) error
- func (a *Application) PageCreateHandler(c echo.Context) error
- func (a *Application) PageDelete(c echo.Context, id string) error
- func (a *Application) PageDeleteHandler(c echo.Context) error
- func (a *Application) PageIndex(c echo.Context, page int, limit int) error
- func (a *Application) PageIndexHandler(c echo.Context) error
- func (a *Application) PageSettings(c echo.Context, id string, setting *Setting) error
- func (a *Application) PageSettingsHandler(c echo.Context) error
- func (a *Application) PageShow(c echo.Context, id string) error
- func (a *Application) PageShowHandler(c echo.Context) error
- func (a *Application) PageUpdate(c echo.Context, id string, req *Page) error
- func (a *Application) PageUpdateHandler(c echo.Context) error
- func (a *Application) PageVideos(c echo.Context, id string, page int, limit int) error
- func (a *Application) PageVideosHandler(c echo.Context) error
- func (a *Application) Routes()
- func (a *Application) VideoCreate(c echo.Context, video *Video) error
- func (a *Application) VideoCreateHandler(c echo.Context) error
- func (a *Application) VideoDelete(c echo.Context, id string) error
- func (a *Application) VideoDeleteHandler(c echo.Context) error
- func (a *Application) VideoIndex(c echo.Context, page int, limit int) error
- func (a *Application) VideoIndexHandler(c echo.Context) error
- func (a *Application) VideoSettings(c echo.Context, id string, setting *Setting) error
- func (a *Application) VideoSettingsHandler(c echo.Context) error
- func (a *Application) VideoShow(c echo.Context, id string) error
- func (a *Application) VideoShowHandler(c echo.Context) error
- func (a *Application) VideoUpdate(c echo.Context, id string, video *Video) error
- func (a *Application) VideoUpdateHandler(c echo.Context) error
- func (a *Application) VisitCreate(c echo.Context, visit *Visit) error
- func (a *Application) VisitCreateHandler(c echo.Context) error
- func (a *Application) VisitDelete(c echo.Context, id string) error
- func (a *Application) VisitDeleteHandler(c echo.Context) error
- func (a *Application) VisitIndex(c echo.Context, page int, limit int) error
- func (a *Application) VisitIndexHandler(c echo.Context) error
- func (a *Application) VisitSettings(c echo.Context, id string, setting *Setting) error
- func (a *Application) VisitSettingsHandler(c echo.Context) error
- func (a *Application) VisitShow(c echo.Context, id string) error
- func (a *Application) VisitShowHandler(c echo.Context) error
- func (a *Application) VisitUpdate(c echo.Context, id string, visit *Visit) error
- func (a *Application) VisitUpdateHandler(c echo.Context) error
- type Config
- type Connection
- type ConnectionSet
- type Connector
- func (c *Connector) IsVisited(page *Page, url string) (bool, error)
- func (c *Connector) PageExists(name string) bool
- func (c *Connector) PageGet(id string) (*Page, error)
- func (c *Connector) PageList() ([]*Page, error)
- func (c *Connector) VideoGet(id string) (*Video, error)
- func (c *Connector) VideoList() ([]*Video, error)
- func (c *Connector) VisitGet(id string) (*Visit, error)
- func (c *Connector) VisitList() ([]*Visit, error)
- type H
- type Page
- type ScrapeAll
- type ScrapePage
- type Setting
- type Video
- type Visit
- type YtdlpList
- type YtdlpParse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func QueryDefaultInteger ¶
QueryDefaultInt retrieves an integer param from the gin request querystring defaults to def argument if not found
func QueryString ¶
QueryString retrieves a string param from the gin request querystring
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
}
func (*Application) PageCreate ¶
func (a *Application) PageCreate(c echo.Context, req *Page) error
POST /page/
func (*Application) PageCreateHandler ¶
func (a *Application) PageCreateHandler(c echo.Context) error
func (*Application) PageDelete ¶
func (a *Application) PageDelete(c echo.Context, id string) error
DELETE /page/:id
func (*Application) PageDeleteHandler ¶
func (a *Application) PageDeleteHandler(c echo.Context) error
func (*Application) PageIndexHandler ¶
func (a *Application) PageIndexHandler(c echo.Context) error
Page (/page)
func (*Application) PageSettings ¶
PATCH /page/:id
func (*Application) PageSettingsHandler ¶
func (a *Application) PageSettingsHandler(c echo.Context) error
func (*Application) PageShow ¶
func (a *Application) PageShow(c echo.Context, id string) error
GET /page/:id
func (*Application) PageShowHandler ¶
func (a *Application) PageShowHandler(c echo.Context) error
func (*Application) PageUpdate ¶
PUT /page/:id
func (*Application) PageUpdateHandler ¶
func (a *Application) PageUpdateHandler(c echo.Context) error
func (*Application) PageVideos ¶ added in v0.3.3
GET /page/:id/videos
func (*Application) PageVideosHandler ¶ added in v0.3.3
func (a *Application) PageVideosHandler(c echo.Context) error
func (*Application) Routes ¶
func (a *Application) Routes()
func (*Application) VideoCreate ¶
func (a *Application) VideoCreate(c echo.Context, video *Video) error
POST /video/
func (*Application) VideoCreateHandler ¶
func (a *Application) VideoCreateHandler(c echo.Context) error
func (*Application) VideoDelete ¶
func (a *Application) VideoDelete(c echo.Context, id string) error
DELETE /video/:id
func (*Application) VideoDeleteHandler ¶
func (a *Application) VideoDeleteHandler(c echo.Context) error
func (*Application) VideoIndex ¶
GET /video/
func (*Application) VideoIndexHandler ¶
func (a *Application) VideoIndexHandler(c echo.Context) error
Video (/video)
func (*Application) VideoSettings ¶
PATCH /video/:id
func (*Application) VideoSettingsHandler ¶
func (a *Application) VideoSettingsHandler(c echo.Context) error
func (*Application) VideoShow ¶
func (a *Application) VideoShow(c echo.Context, id string) error
GET /video/:id
func (*Application) VideoShowHandler ¶
func (a *Application) VideoShowHandler(c echo.Context) error
func (*Application) VideoUpdate ¶
PUT /video/:id
func (*Application) VideoUpdateHandler ¶
func (a *Application) VideoUpdateHandler(c echo.Context) error
func (*Application) VisitCreate ¶
func (a *Application) VisitCreate(c echo.Context, visit *Visit) error
POST /visit/
func (*Application) VisitCreateHandler ¶
func (a *Application) VisitCreateHandler(c echo.Context) error
func (*Application) VisitDelete ¶
func (a *Application) VisitDelete(c echo.Context, id string) error
DELETE /visit/:id
func (*Application) VisitDeleteHandler ¶
func (a *Application) VisitDeleteHandler(c echo.Context) error
func (*Application) VisitIndex ¶
GET /visit/
func (*Application) VisitIndexHandler ¶
func (a *Application) VisitIndexHandler(c echo.Context) error
Visit (/visit)
func (*Application) VisitSettings ¶
PATCH /visit/:id
func (*Application) VisitSettingsHandler ¶
func (a *Application) VisitSettingsHandler(c echo.Context) error
func (*Application) VisitShow ¶
func (a *Application) VisitShow(c echo.Context, id string) error
GET /visit/:id
func (*Application) VisitShowHandler ¶
func (a *Application) VisitShowHandler(c echo.Context) error
func (*Application) VisitUpdate ¶
PUT /visit/:id
func (*Application) VisitUpdateHandler ¶
func (a *Application) VisitUpdateHandler(c echo.Context) error
type Config ¶
type Config struct {
Production bool `env:"PRODUCTION" envDefault:"false"`
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"`
// 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"`
MinionDatabase string `env:"MINION_DATABASE"`
MinionCollection string `env:"MINION_COLLECTION"`
}
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
Page *grimoire.Store[*Page]
Video *grimoire.Store[*Video]
Visit *grimoire.Store[*Visit]
}
func NewConnector ¶
func NewConnector(app *Application) (*Connector, error)
func (*Connector) PageExists ¶
type H ¶
stolen from gin gonic H is a shortcut for map[string]any
func (H) MarshalXML ¶
MarshalXML allows type H to be used with xml.Marshal.
type Page ¶
type Page 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"`
Url string `bson:"url" json:"url"`
Scraper string `bson:"scraper" json:"scraper"`
Downloader string `bson:"downloader" json:"downloader"`
ProcessedAt time.Time `bson:"processed_at" json:"processed_at"`
}
type ScrapeAll ¶
type ScrapeAll struct {
minion.WorkerDefaults[*ScrapeAll]
}
type ScrapePage ¶
type ScrapePage struct {
minion.WorkerDefaults[*ScrapePage]
Title string `json:"title"`
Page *Page `json:"page"`
}
func (*ScrapePage) Kind ¶
func (j *ScrapePage) Kind() string
func (*ScrapePage) Work ¶
func (j *ScrapePage) Work(ctx context.Context, job *minion.Job[*ScrapePage]) error
type Video ¶
type Video 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"`
Title string `bson:"title" json:"title"`
Season int `bson:"season" json:"season"`
Episode int `bson:"episode" json:"episode"`
Raw string `bson:"raw" json:"raw"`
DisplayId string `bson:"display_id" json:"display_id"`
Extension string `bson:"extension" json:"extension"`
Resolution int `bson:"resolution" json:"resolution"`
Size int64 `bson:"size" json:"size"`
Download string `bson:"download" json:"download"`
View string `bson:"view" json:"view"`
Source string `bson:"source" json:"source"`
}
type Visit ¶
type Visit 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"`
PageId primitive.ObjectID `bson:"page_id" json:"page_id"`
Url string `bson:"url" json:"url"`
}
type YtdlpParse ¶
type YtdlpParse struct {
minion.WorkerDefaults[*YtdlpParse]
Name string
Source string
Info *ytdlp.Info
}
func (*YtdlpParse) Kind ¶
func (j *YtdlpParse) Kind() string
func (*YtdlpParse) Work ¶
func (j *YtdlpParse) Work(ctx context.Context, job *minion.Job[*YtdlpParse]) error