ext

package
v0.2.7 Latest Latest
Warning

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

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

Documentation

Overview

Package ext contains a suite of extensions that can be applied on the app.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CachableResource

type CachableResource struct {
	// Data to serialize/unserialize.
	Data []byte
	// Metadata for the resource.
	Info ResourceInfo
}

CachableResource is used as an intermediate struct to be serialized and deserialized for caching.

type Cache

type Cache struct {
	// Resource larger than the specified max size (bytes) will not be cached.
	MaxSizeCached int64
	// Max number of resources to cache in memory at any one time.
	NumCached int
	// contains filtered or unexported fields
}

Cache is use to initialize a gCache (https://github.com/bluele/gcache) to cache resources from S3 compatible storage.

func NewCache

func NewCache(NumCached int, MaxSizeCached int64) *Cache

NewCache creates a new Cache object.

type Config

type Config = minio.Config

Config is an alias for core.MinioConfig

type Core

type Core = core.Core

Core is an alias for core.Core

type Extension

type Extension = core.Extension

Extension is an alias for core.Extension

func CacheRequestsExtension

func CacheRequestsExtension(NumCached int, MaxSizeCached int64) Extension

CacheRequestsExtension installs the extension to cache all GetObject requests to the S3 compatible backend.

func DefaultFaviconExtension

func DefaultFaviconExtension(filepath string) Extension

DefaultFaviconExtension returns a default favicon if backend does not have one.

func DefaultIndexFileExtension

func DefaultIndexFileExtension(filenames ...string) Extension

DefaultIndexFileExtension installs the extension where a default index file is queried if not provided in the url (e.g. http://abc instead of http://abc/efg.html).

func ListFolderExtension

func ListFolderExtension(helper *MinioHelper, listFolder bool, listFolderObjects string) Extension

ListFolderExtension installs the extension to list folder objects.

func RenderMarkdownExtension

func RenderMarkdownExtension(templateFile string) Extension

RenderMarkdownExtension installs the markdown extension if a template is provided.

type Favicon

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

Favicon provides decorator to return a default favicon.

func (*Favicon) Handler

func (f *Favicon) Handler(url string) (Resource, error)

Handler returns a default favicon for a favicon request.

type Handler

type Handler = core.Handler

Handler is an alias for core.Handler

type HandlerDecorator

type HandlerDecorator = core.HandlerDecorator

HandlerDecorator is an alias for core.HandlerDecorator

func GetIndexFileDecorator

func GetIndexFileDecorator(filenames []string) HandlerDecorator

GetIndexFileDecorator installs the extension where a default index file is queried if not provided in the url (e.g. http://abc instead of http://abc/efg.html).

type IndexHTML

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

IndexHTML provides the decorator to insert a default index file to any requests.

func (IndexHTML) GetIndexHTML

func (i IndexHTML) GetIndexHTML(handler Handler) Handler

GetIndexHTML decorates a GetObject or StatObject function to insert the default index file if required.

type ListFolderExt

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

ListFolderExt describes the extension to list objects inside a pseudo-minio folder.

func NewListFolderExt

func NewListFolderExt(helper *MinioHelper, listFolder bool, listFolderObjects string) (*ListFolderExt, error)

NewListFolderExt creates a new ListFolderExt object.

func (*ListFolderExt) ListObjectsAsMarkdown

func (ext *ListFolderExt) ListObjectsAsMarkdown(url string) (Resource, error)

ListObjectsAsMarkdown retrieves (non-recursive) objects with a specified prefix and rendered them as markdown Resource.

type Markdown

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

Markdown provides the decorator to serve markdowns as HMTL.

func (Markdown) RenderMarkdown

func (m Markdown) RenderMarkdown(Serve ServeHandler) ServeHandler

RenderMarkdown decorates a Serve function to render and return a HTML resource from a markdown resource.

type MinioHelper

type MinioHelper = minio.Helper

MinioHelper is an alias for minio.MinioHelper

type Resource

type Resource = core.Resource

Resource is an alias for core.Resource

type ResourceInfo

type ResourceInfo = core.ResourceInfo

ResourceInfo is an alias for core.ResourceInfo

type ServeHandler

type ServeHandler = core.ServeHandler

ServeHandler is an alias for core.ServeHandler

type ServeHandlerDecorator

type ServeHandlerDecorator = core.ServeHandlerDecorator

ServeHandlerDecorator is an alias for core.ServeHandlerDecorator

type TemplateData

type TemplateData struct {
	Content template.HTML
}

TemplateData provides the view to the HTML template.

Jump to

Keyboard shortcuts

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