app

package
v0.10.4 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: Apache-2.0 Imports: 35 Imported by: 0

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.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FileCopy

func FileCopy(srcpath, dstpath string) (err error)

https://stackoverflow.com/questions/21060945/simple-way-to-copy-a-file Copy copies the contents of the file at srcpath to a regular file at dstpath. If dstpath already exists and is not a directory, the function truncates it. The function does not copy file modes or file attributes.

func FileDir

func FileDir(file string) error
func FileLink(srcpath, dstpath string, force bool) error

FileLink creates hard link, if destination exists and force is true, it will remove the destination before linking

func QueryBool

func QueryBool(c echo.Context, name string) bool

QueryBool retrieves a boolean param from the gin request querystring

func QueryDefaultInteger

func QueryDefaultInteger(c echo.Context, name string, def int) (int, error)

QueryDefaultInt retrieves an integer param from the gin request querystring defaults to def argument if not found

func QueryDefaultString

func QueryDefaultString(c echo.Context, name, def string) string

func QueryInt

func QueryInt(c echo.Context, name string) int

QueryInt retrieves an integer param from the gin request querystring

func QueryString

func QueryString(c echo.Context, name string) string

QueryString retrieves a string param from the gin request querystring

func Setup

func Setup() error

func Start

func Start() error

func WithTimeout

func WithTimeout(delegate func() interface{}, timeout time.Duration) (ret interface{}, ok bool)

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

	// Events
	Events *Events

	Client  *search.Client
	ES      *elasticsearch.Client
	Nzbgeek *nzbgeek.Client
	Tmdb    *tmdb.Client
	Tvdb    *tvdb.Client
}

func (*Application) CreateReleasesSearch

func (a *Application) CreateReleasesSearch(c echo.Context) (*search.ReleaseSearch, error)

func (*Application) CreateRunicSearch

func (a *Application) CreateRunicSearch(c echo.Context) (*search.RunicSearch, error)

func (*Application) CreateSearch

func (a *Application) CreateSearch(c echo.Context) (*search.MediaSearch, error)

func (*Application) ElasticSearchIndex

func (a *Application) ElasticSearchIndex(payload any) error

func (*Application) EsIndex

func (a *Application) EsIndex(c echo.Context) error

func (*Application) EsIndexHandler

func (a *Application) EsIndexHandler(c echo.Context) error

Es (/es)

func (*Application) EsMedia

func (a *Application) EsMedia(c echo.Context) error

func (*Application) EsMediaHandler

func (a *Application) EsMediaHandler(c echo.Context) error

func (*Application) EsRelease

func (a *Application) EsRelease(c echo.Context) error

func (*Application) EsReleaseHandler

func (a *Application) EsReleaseHandler(c echo.Context) error

func (*Application) Health

func (a *Application) Health() (map[string]bool, error)

func (*Application) MediaIndex

func (a *Application) MediaIndex(c echo.Context, start, limit int, types, name, display, title, source, source_id string) error

func (*Application) MediaIndexHandler

func (a *Application) MediaIndexHandler(c echo.Context) error

Media (/media)

func (*Application) NzbsMovie

func (a *Application) NzbsMovie(c echo.Context) error

func (*Application) NzbsMovieHandler

func (a *Application) NzbsMovieHandler(c echo.Context) error

Nzbs (/nzbs)

func (*Application) NzbsTv

func (a *Application) NzbsTv(c echo.Context) error

func (*Application) NzbsTvHandler

func (a *Application) NzbsTvHandler(c echo.Context) error

func (*Application) ReleasesIndex

func (a *Application) ReleasesIndex(c echo.Context, start, limit int, type_, text string, year, season, episode int, group, author string, resolution int, source string, uncensored, bluray, verified, exact bool) error

func (*Application) ReleasesIndexHandler

func (a *Application) ReleasesIndexHandler(c echo.Context) error

Releases (/releases)

func (*Application) Routes

func (a *Application) Routes()

func (*Application) RunicIndex

func (a *Application) RunicIndex(c echo.Context, start, limit int, type_, text string, year, season, episode int, group, website string, resolution int, source string, uncensored, bluray, verified, exact bool) error

GET /runic/

func (*Application) RunicIndexHandler

func (a *Application) RunicIndexHandler(c echo.Context) error

Runic (/runic)

func (*Application) SearchIndex

func (a *Application) SearchIndex(c echo.Context, start, limit int, types, q, name string) error

func (*Application) SearchIndexHandler

func (a *Application) SearchIndexHandler(c echo.Context) error

Search (/search)

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"`

	// Router Auth
	Auth           bool   `env:"AUTH" envDefault:"false"`
	ClerkSecretKey string `env:"CLERK_SECRET_KEY"`
	ClerkToken     string `env:"CLERK_TOKEN"`

	// Events
	NatsURL string `env:"NATS_URL"`

	ElasticsearchURL string `env:"ELASTICSEARCH_URL,required"`
	NzbgeekKey       string `env:"NZBGEEK_KEY,required"`
	NzbgeekURL       string `env:"NZBGEEK_URL,required"`
	TvdbKey          string `env:"TVDB_KEY,required"`
	TmdbToken        string `env:"TMDB_TOKEN,required"`
	Production       bool   `env:"PRODUCTION" envDefault:"false"`
}

func (*Config) ConnectionFor

func (c *Config) ConnectionFor(name string) (*Connection, error)

func (*Config) Validate

func (c *Config) Validate() 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
}

func NewConnector

func NewConnector(app *Application) (*Connector, error)

type ElasticSearchIndexPayload

type ElasticSearchIndexPayload struct {
	Index string
	Model interface{}
}

type EventMovies

type EventMovies struct {
	Event string        `bson:"event" json:"event"`
	ID    string        `bson:"id" json:"id"`
	Movie *search.Media `bson:"movie" json:"movie"`
}

type EventSeries

type EventSeries struct {
	Event  string        `bson:"event" json:"event"`
	ID     string        `bson:"id" json:"id"`
	Series *search.Media `bson:"series" json:"series"`
}

type Events

type Events struct {
	App      *Application
	Merc     *mercury.Mercury
	Log      *zap.SugaredLogger
	Movies   chan *EventMovies
	Releases chan *search.Release
	Runic    chan *runic.Release
	Series   chan *EventSeries
}

func NewEvents

func NewEvents(app *Application) (*Events, error)

func (*Events) Send

func (e *Events) Send(topic EventsTopic, data any) error

func (*Events) Start

func (e *Events) Start() error

type EventsChannel

type EventsChannel string

type EventsTopic

type EventsTopic string

type H

type H map[string]any

stolen from gin gonic H is a shortcut for map[string]any

func (H) MarshalXML

func (h H) MarshalXML(e *xml.Encoder, start xml.StartElement) error

MarshalXML allows type H to be used with xml.Marshal.

type Response

type Response struct {
	Error   bool        `json:"error"`
	Message string      `json:"message,omitempty"`
	Result  interface{} `json:"result,omitempty"`
	Total   int64       `json:"total,omitempty"`
}

type SearchAllResponse

type SearchAllResponse struct {
	Media *SearchResponse `bson:"media" json:"media"`
	Tmdb  *SearchResponse `bson:"tmdb" json:"tmdb"`
	Tvdb  *SearchResponse `bson:"tvdb" json:"tvdb"`
}

type SearchResponse

type SearchResponse struct {
	Results []*SearchResult `bson:"results" json:"results"`
	Error   string          `bson:"error" json:"error"`
}

type SearchResult

type SearchResult struct {
	ID          string `bson:"id" json:"id"`
	Title       string `bson:"title" json:"title"`
	Description string `bson:"description" json:"description"`
	Type        string `bson:"type" json:"type"`
	Kind        string `bson:"kind" json:"kind"`
	Date        string `bson:"date" json:"date"`
	Source      string `bson:"source" json:"source"`
	Image       string `bson:"image" json:"image"`
}

type Setting

type Setting struct {
	Name  string `json:"name"`
	Value bool   `json:"value"`
}

type SettingsBatch

type SettingsBatch struct {
	IDs   []string `json:"ids"`
	Name  string   `json:"name"`
	Value bool     `json:"value"`
}

Jump to

Keyboard shortcuts

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