theme

package module
v0.0.0-...-3b97e19 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2023 License: MIT Imports: 11 Imported by: 0

README

Theme

Installation

go get -u github.com/gowool/theme

License

Distributed under MIT License, please see license file within the code for more details.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BeforeWrite

type BeforeWrite func(ctx context.Context, name string, data interface{}) (newName string, newData interface{}, err error)

type Cache

type Cache interface {
	Set(ctx context.Context, key string, value interface{}, tags ...string) error
	Get(ctx context.Context, key string, value interface{}) error
	DelByKey(ctx context.Context, key string) error
	DelByTag(ctx context.Context, tag string) error
}

type CacheRepository

type CacheRepository struct {
	Repository
	Cache Cache
}

func (CacheRepository) DeleteByID

func (r CacheRepository) DeleteByID(ctx context.Context, id uuid.UUID) error

func (CacheRepository) FindByCode

func (r CacheRepository) FindByCode(ctx context.Context, code string, date time.Time) (template *Template, err error)

func (CacheRepository) FindByID

func (r CacheRepository) FindByID(ctx context.Context, id uuid.UUID) (template *Template, err error)

func (CacheRepository) Save

func (r CacheRepository) Save(ctx context.Context, template *Template) error

type ChainLoader

type ChainLoader = et.ChainLoader

type Environment

type Environment struct {
	*et.Environment
	// contains filtered or unexported fields
}

func New

func New(loader Loader, beforeWrite BeforeWrite, handlers ...Handler) *Environment

func (*Environment) Debug

func (t *Environment) Debug(debug bool) Theme

func (*Environment) Funcs

func (t *Environment) Funcs(funcMap template.FuncMap) Theme

func (*Environment) Global

func (t *Environment) Global(global ...string) Theme

func (*Environment) HTML

func (t *Environment) HTML(ctx context.Context, name string, data interface{}) (string, error)

func (*Environment) Write

func (t *Environment) Write(ctx context.Context, w io.Writer, name string, data interface{}) error

type FilesystemLoader

type FilesystemLoader = et.FilesystemLoader

type FuncMap

type FuncMap = template.FuncMap

type Handler

type Handler = et.Handler

type Loader

type Loader = et.Loader

type MemoryLoader

type MemoryLoader = et.MemoryLoader

type Repository

type Repository interface {
	Find(ctx context.Context, criteria *cr.Criteria) ([]*Template, int, error)
	FindByID(ctx context.Context, id uuid.UUID) (*Template, error)
	FindByCode(ctx context.Context, code string, date time.Time) (*Template, error)
	DeleteByID(ctx context.Context, id uuid.UUID) error
	Save(ctx context.Context, template *Template) error
}

type Source

type Source = et.Source

type Template

type Template struct {
	ID        uuid.UUID  `cfg:"id,omitempty" json:"id,omitempty" yaml:"id,omitempty" bson:"id,omitempty"`
	Code      string     `cfg:"code,omitempty" json:"code,omitempty" yaml:"code,omitempty" bson:"code,omitempty"`
	Content   string     `cfg:"content,omitempty" json:"content,omitempty" yaml:"content,omitempty" bson:"content,omitempty"`
	Created   time.Time  `cfg:"created,omitempty" json:"created,omitempty" yaml:"created,omitempty" bson:"created,omitempty"`
	Updated   time.Time  `cfg:"updated,omitempty" json:"updated,omitempty" yaml:"updated,omitempty" bson:"updated,omitempty"`
	Published *time.Time `cfg:"published,omitempty" json:"published,omitempty" yaml:"published,omitempty" bson:"published,omitempty"`
	Expired   *time.Time `cfg:"expired,omitempty" json:"expired,omitempty" yaml:"expired,omitempty" bson:"expired,omitempty"`
}

func (*Template) ContentBytes

func (t *Template) ContentBytes() []byte

func (*Template) Enabled

func (t *Template) Enabled(now time.Time) bool

func (*Template) String

func (t *Template) String() string

type TemplateLoader

type TemplateLoader struct {
	Repository Repository
}

func (TemplateLoader) Exists

func (s TemplateLoader) Exists(ctx context.Context, name string) (bool, error)

func (TemplateLoader) Get

func (s TemplateLoader) Get(ctx context.Context, name string) (*Source, error)

func (TemplateLoader) IsFresh

func (s TemplateLoader) IsFresh(ctx context.Context, name string, t int64) (bool, error)

type Theme

type Theme interface {
	Debug(debug bool) Theme
	Funcs(funcMap FuncMap) Theme
	Global(global ...string) Theme
	Write(ctx context.Context, w io.Writer, name string, data interface{}) error
	HTML(ctx context.Context, name string, data interface{}) (string, error)
}

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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