Documentation
¶
Index ¶
- Constants
- Variables
- func IsReservedName(templateName string) bool
- func MessageContentByReceiverType(messagesTemplate []Message, receiverType string) (string, error)
- func RenderBody(templateBody string, aStruct any, leftDelim, rightDelim string) (string, error)
- func RenderWithEnrichedDefault(templateBody string, templateVars []Variable, ...) (string, error)
- type File
- type FileBody
- type Filter
- type Message
- type NotFoundError
- type Repository
- type Rule
- 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 Variable
Constants ¶
View Source
const ( DelimMessageLeft = "{{" DelimMessageRight = "}}" )
View Source
const (
ReservedName_SystemDefault = "system-default"
)
Variables ¶
View Source
var (
ErrDuplicate = errors.New("name already exist")
)
Functions ¶
func IsReservedName ¶
func MessageContentByReceiverType ¶ added in v0.7.1
func RenderBody ¶
Types ¶
type File ¶ added in v0.7.1
type File struct {
Name string `yaml:"name"`
ApiVersion string `yaml:"apiVersion"`
Type string `yaml:"type"`
Body []FileBody `yaml:"body"`
Message Message `yaml:"message"`
Tags []string `yaml:"tags"`
Delete bool `yaml:"delete"`
Variables []Variable `yaml:"variables"`
}
func YamlStringToFile ¶ added in v0.7.1
type Message ¶ added in v0.7.1
type Message struct {
ReceiverType string `yaml:"receiver_type,omitempty"` // mandatory
Content string `yaml:"content,omitempty"`
}
func MessagesFromBody ¶ added in v0.7.1
type NotFoundError ¶
type NotFoundError struct {
Name string
}
func (NotFoundError) Error ¶
func (err NotFoundError) Error() string
type Repository ¶
type Rule ¶ added in v0.7.1
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
Source Files
¶
Click to show internal directories.
Click to hide internal directories.