rendering

package
v0.0.0-test Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2021 License: AGPL-3.0 Imports: 26 Imported by: 280

Documentation

Index

Constants

View Source
const ServiceName = "RenderingService"

Variables

View Source
var ErrConcurrentLimitReached = errors.New("rendering concurrent limit reached")
View Source
var ErrRenderUnavailable = errors.New("rendering plugin not available")
View Source
var ErrTimeout = errors.New("timeout error - you can set timeout in seconds with &timeout url parameter")

Functions

This section is empty.

Types

type CSVOpts

type CSVOpts struct {
	Timeout         time.Duration
	OrgID           int64
	UserID          int64
	OrgRole         models.RoleType
	Path            string
	Encoding        string
	Timezone        string
	ConcurrentLimit int
	Headers         map[string][]string
}

type Opts

type Opts struct {
	Width             int
	Height            int
	Timeout           time.Duration
	OrgID             int64
	UserID            int64
	OrgRole           models.RoleType
	Path              string
	Encoding          string
	Timezone          string
	ConcurrentLimit   int
	DeviceScaleFactor float64
	Headers           map[string][]string
	Theme             Theme
}

type RenderCSVResult

type RenderCSVResult struct {
	FilePath string
	FileName string
}

type RenderResult

type RenderResult struct {
	FilePath string
}

type RenderType

type RenderType string
const (
	RenderCSV RenderType = "csv"
	RenderPNG RenderType = "png"
)

type RenderUser

type RenderUser struct {
	OrgID   int64
	UserID  int64
	OrgRole string
}

type RenderingService

type RenderingService struct {
	Cfg                   *setting.Cfg
	RemoteCacheService    *remotecache.RemoteCache
	RendererPluginManager plugins.RendererManager
	// contains filtered or unexported fields
}

func ProvideService

func ProvideService(cfg *setting.Cfg, remoteCache *remotecache.RemoteCache, rm plugins.RendererManager) (*RenderingService, error)

func (*RenderingService) GetRenderUser

func (rs *RenderingService) GetRenderUser(key string) (*RenderUser, bool)

func (*RenderingService) IsAvailable

func (rs *RenderingService) IsAvailable() bool

func (*RenderingService) Render

func (rs *RenderingService) Render(ctx context.Context, opts Opts) (*RenderResult, error)

func (*RenderingService) RenderCSV

func (rs *RenderingService) RenderCSV(ctx context.Context, opts CSVOpts) (*RenderCSVResult, error)

func (*RenderingService) RenderErrorImage

func (rs *RenderingService) RenderErrorImage(theme Theme, err error) (*RenderResult, error)

func (*RenderingService) Run

func (rs *RenderingService) Run(ctx context.Context) error

func (*RenderingService) Version

func (rs *RenderingService) Version() string

type Service

type Service interface {
	IsAvailable() bool
	Version() string
	Render(ctx context.Context, opts Opts) (*RenderResult, error)
	RenderCSV(ctx context.Context, opts CSVOpts) (*RenderCSVResult, error)
	RenderErrorImage(theme Theme, error error) (*RenderResult, error)
	GetRenderUser(key string) (*RenderUser, bool)
}

type Theme

type Theme string
const (
	ThemeLight Theme = "light"
	ThemeDark  Theme = "dark"
)

Jump to

Keyboard shortcuts

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