Documentation ¶
Index ¶
- Constants
- Variables
- func IsReservedName(templateName string) bool
- func RenderBody(templateBody string, aStruct interface{}) (string, error)
- func RenderWithEnrichedDefault(templateBody string, templateVars []Variable, ...) (string, error)
- type Filter
- type NotFoundError
- type Repository
- type Service
- func (s *Service) Delete(ctx context.Context, name string) error
- func (s *Service) GetByName(ctx context.Context, name string) (*Template, error)
- func (s *Service) List(ctx context.Context, flt Filter) ([]Template, error)
- func (s *Service) Render(ctx context.Context, name string, requestVariables map[string]string) (string, error)
- func (s *Service) Upsert(ctx context.Context, template *Template) error
- type Template
- type TemplateFile
- type Variable
Constants ¶
View Source
const (
ReservedName_SystemDefault = "system-default"
)
Variables ¶
View Source
var (
ErrDuplicate = errors.New("name already exist")
)
Functions ¶
func IsReservedName ¶
func RenderBody ¶
Types ¶
type NotFoundError ¶
type NotFoundError struct {
Name string
}
func (NotFoundError) Error ¶
func (err NotFoundError) Error() string
type Repository ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service handles business logic
func NewService ¶
func NewService(repository Repository) *Service
NewService returns repository struct
type Template ¶
type Template struct { ID uint64 `json:"id"` Name string `json:"name" validate:"required"` Body string `json:"body" validate:"required"` Tags []string `json:"tags" validate:"required"` Variables []Variable `json:"variables" validate:"required,dive,required"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` }
func FromV1beta1Proto ¶ added in v0.6.7
func FromV1beta1Proto(proto *sirenv1beta1.Template) Template
func (*Template) ToV1beta1Proto ¶ added in v0.6.7
func (t *Template) ToV1beta1Proto() *sirenv1beta1.Template
type TemplateFile ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.