models

package
v0.14.1 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DTOEnvelopeFieldCreatedAt = "created_at"
	DTOEnvelopeFieldFrom      = "from"
	DTOEnvelopeFieldSubject   = "subject"
)
View Source
const EndpointBodyTemplate = "{{ .Message.Text }}"
View Source
const EndpointTitleTemplate = "{{ .Message.Subject }}"

Variables

View Source
var (
	ErrNotFound         = fmt.Errorf("not found")
	ErrAuthInvalid      = fmt.Errorf("auth invalid")
	ErrInternalResource = fmt.Errorf("internal resource")
)

Functions

func NewDTOEnvelopeField added in v0.13.0

func NewDTOEnvelopeField(s string) dtoEnvelopeField

Types

type Attachment added in v0.13.0

type Attachment struct {
	ID        int64 `sql:"primary_key"`
	MessageID int64
	Name      string
	Mime      string
	Extension string
}

func (Attachment) FileName added in v0.13.0

func (a Attachment) FileName() string

func (Attachment) IsImage added in v0.13.0

func (a Attachment) IsImage() bool

type Auth added in v0.12.0

type Auth struct {
	Anonymous bool
	Username  string
	Password  string
}

type Config added in v0.12.0

type Config struct {
	RetentionPolicy ConfigRetentionPolicy
	AuthSMTP        Auth
	AuthHTTP        Auth
}

type ConfigRetentionPolicy added in v0.13.0

type ConfigRetentionPolicy struct {
	MinAge         time.Duration
	EnvelopeCount  *int
	EnvelopeAge    *time.Duration
	AttachmentSize *int64
	TraceAge       *time.Duration
}

func (ConfigRetentionPolicy) EnvelopeAgeTime added in v0.13.0

func (p ConfigRetentionPolicy) EnvelopeAgeTime() time.Time

func (ConfigRetentionPolicy) MinAgeTime added in v0.13.0

func (p ConfigRetentionPolicy) MinAgeTime() time.Time

type DTOAttachmentCreate added in v0.13.0

type DTOAttachmentCreate struct {
	Name string
	Data io.Reader
}

type DTOAttachmentListRequest added in v0.13.0

type DTOAttachmentListRequest struct {
	Ascending bool
}

type DTOAttachmentListResult added in v0.13.0

type DTOAttachmentListResult struct {
	PageResult  pagination.PageResult
	Attachments []Attachment
}

type DTOEndpointCreate added in v0.14.0

type DTOEndpointCreate struct {
	Name              string
	AttachmentDisable bool
	TextDisable       bool
	TitleTemplate     string
	BodyTemplate      string
	Kind              string
	Config            map[string]string
}

type DTOEndpointUpdate added in v0.14.0

type DTOEndpointUpdate struct {
	ID                int64
	Name              *string
	AttachmentDisable *bool
	TextDisable       *bool
	TitleTemplate     *string
	BodyTemplate      *string
	Kind              *string
	Config            *map[string]string
}

type DTOEnvelopeListRequest added in v0.13.0

type DTOEnvelopeListRequest struct {
	Search        string
	SearchSubject bool
	SearchText    bool
	Ascending     bool
	Order         dtoEnvelopeField
}

type DTOEnvelopeListResult added in v0.13.0

type DTOEnvelopeListResult struct {
	PageResult pagination.PageResult
	Envelopes  []Envelope
}

type DTOMessageCreate added in v0.13.0

type DTOMessageCreate struct {
	Date    time.Time
	Subject string
	From    string
	To      []string
	Text    string
	HTML    string
}

type DTORuleCreate added in v0.13.0

type DTORuleCreate struct {
	Name       string
	Expression string
	Endpoints  []int64
}

type DTORuleUpdate added in v0.13.0

type DTORuleUpdate struct {
	ID         int64
	Name       *string
	Expression *string
	Enable     *bool
	Endpoints  *[]int64
}

type DTOTraceListRequest added in v0.13.0

type DTOTraceListRequest struct {
	Ascending bool
}

type DTOTraceListResult added in v0.13.0

type DTOTraceListResult struct {
	PageResult pagination.PageResult
	Traces     [][]Trace
}

type DataAttachment added in v0.13.0

type DataAttachment struct {
	io.Reader
	Attachment Attachment
}

type Endpoint added in v0.13.0

type Endpoint struct {
	ID                int64 `sql:"primary_key"`
	Internal          bool
	InternalID        sql.NullString
	Name              string
	AttachmentDisable bool
	TextDisable       bool
	TitleTemplate     string
	BodyTemplate      string
	Kind              string
	Config            EndpointConfig
}

type EndpointConfig added in v0.13.0

type EndpointConfig map[string]string

func (*EndpointConfig) Scan added in v0.13.0

func (dst *EndpointConfig) Scan(src any) error

func (EndpointConfig) Str added in v0.13.0

func (c EndpointConfig) Str(key string) string

func (EndpointConfig) StrSlice added in v0.13.0

func (c EndpointConfig) StrSlice(key string) []string

func (EndpointConfig) Value added in v0.13.0

func (src EndpointConfig) Value() (driver.Value, error)

type EndpointSchema added in v0.14.0

type EndpointSchema []EndpointSchemaItem

func (EndpointSchema) Filter added in v0.14.0

func (e EndpointSchema) Filter(kind string, config EndpointConfig) EndpointConfig

func (EndpointSchema) Get added in v0.14.0

type EndpointSchemaField added in v0.14.0

type EndpointSchemaField struct {
	Name        string
	Description string
	Example     string
	Key         string
	Multiline   bool
	Optional    bool
}

type EndpointSchemaItem added in v0.14.0

type EndpointSchemaItem struct {
	Name   string
	Kind   string
	Fields []EndpointSchemaField
}

func (EndpointSchemaItem) Filter added in v0.14.0

type Envelope added in v0.13.0

type Envelope struct {
	Message     Message
	Attachments []Attachment
}

type EventEnvelopeCreated added in v0.13.0

type EventEnvelopeCreated struct {
	ID int64
}

type EventEnvelopeDeleted added in v0.13.0

type EventEnvelopeDeleted struct {
}

type EventMailmanEnqueued added in v0.13.0

type EventMailmanEnqueued struct {
}

type Field added in v0.14.0

type Field string
const (
	FieldName          Field = "name"
	FieldExpression    Field = "expression"
	FieldTitleTemplate Field = "title template"
	FieldBodyTemplate  Field = "body template"
	FieldKind          Field = "kind"
	FieldConfig        Field = "config"
)

type FieldError added in v0.14.0

type FieldError struct {
	Field Field
	Err   error
}

func (FieldError) Error added in v0.14.0

func (e FieldError) Error() string

func (FieldError) Unwrap added in v0.14.0

func (e FieldError) Unwrap() error

type Message added in v0.13.0

type Message struct {
	ID        int64 `sql:"primary_key"`
	CreatedAt Time
	Date      Time
	Subject   string
	From      string
	To        MessageTo
	Text      string
	HTML      string
}

type MessageTo added in v0.13.0

type MessageTo []string

func (MessageTo) EQ added in v0.13.0

func (ss MessageTo) EQ(strs ...string) bool

func (*MessageTo) Scan added in v0.13.0

func (dst *MessageTo) Scan(src any) error

func (MessageTo) Value added in v0.13.0

func (src MessageTo) Value() (driver.Value, error)

type Rule added in v0.13.0

type Rule struct {
	ID         int64 `sql:"primary_key"`
	Internal   bool
	InternalID sql.NullString
	Name       string
	Expression string
	Enable     bool
}

type RuleEndpoints added in v0.13.0

type RuleEndpoints struct {
	Rule      Rule
	Endpoints []Endpoint
}

type Storage

type Storage struct {
	EnvelopeCount   int
	AttachmentCount int
	AttachmentSize  int64
	DatabaseSize    int64
}

type Time added in v0.13.0

type Time time.Time

func NewTime added in v0.13.0

func NewTime(time time.Time) Time

func (*Time) Scan added in v0.13.0

func (dst *Time) Scan(src any) error

func (Time) Time added in v0.13.0

func (t Time) Time() time.Time

func (Time) Value added in v0.13.0

func (src Time) Value() (driver.Value, error)

type Trace added in v0.13.0

type Trace struct {
	ID        int64 `sql:"primary_key"`
	Seq       int
	RequestID string
	Source    string
	Action    string
	Level     TraceLevel
	Data      TraceData
	CreatedAt Time
}

type TraceData added in v0.13.0

type TraceData []TraceDataKV

func (*TraceData) Scan added in v0.13.0

func (dst *TraceData) Scan(src any) error

func (TraceData) Value added in v0.13.0

func (src TraceData) Value() (driver.Value, error)

type TraceDataKV added in v0.13.0

type TraceDataKV struct {
	Key   string
	Value string
}

func (TraceDataKV) ValueInt64 added in v0.13.0

func (t TraceDataKV) ValueInt64() int64

type TraceLevel added in v0.13.0

type TraceLevel string

type User added in v0.13.0

type User struct {
	ID       int64 `sql:"primary_key"`
	Username string
}

Jump to

Keyboard shortcuts

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