Documentation
¶
Index ¶
- Constants
- func FilterTimes(items []time.Time, filter func(t time.Time) bool) (filtered, other []time.Time)
- func TimesAt(items []time.Time, at time.Time) (filtered, other []time.Time)
- func ToDay(t time.Time) time.Time
- func ToMonth(t time.Time) time.Time
- func ToWeek(t time.Time) time.Time
- func ToYear(t time.Time) time.Time
- type ArchivedBackuper
- type Backup
- func (b *Backup) DetailString(ctx context.Context) string
- func (b *Backup) GetCreatedAt() time.Time
- func (b *Backup) GetDbName() string
- func (b *Backup) GetID() (id BackupID)
- func (b *Backup) GetMessage() string
- func (b *Backup) GetSize() int64
- func (b *Backup) IsAuto() bool
- func (b *Backup) Open() (io.ReadCloser, error)
- type BackupController
- type BackupID
- type Backuper
- type BackupsMapper
- type DateTimeFilter
- type DateTimeRangeFilter
- type DateTimeValueFilter
- type Group
- type Groups
- type IntervalGrouper
- type ListFilter
- type ListFilterBuilder
- func (b *ListFilterBuilder) DateTime() DateTimeFilter
- func (b *ListFilterBuilder) Day() ListFilterIntValuer
- func (b *ListFilterBuilder) Hour() ListFilterIntValuer
- func (b *ListFilterBuilder) MarshalJSON() ([]byte, error)
- func (b *ListFilterBuilder) Month() ListFilterIntValuer
- func (b *ListFilterBuilder) WithDateTime(v DateTimeFilter) *ListFilterBuilder
- func (b *ListFilterBuilder) WithDay(v ListFilterIntValuer) *ListFilterBuilder
- func (b *ListFilterBuilder) WithHour(v ListFilterIntValuer) *ListFilterBuilder
- func (b *ListFilterBuilder) WithMonth(v ListFilterIntValuer) *ListFilterBuilder
- func (b *ListFilterBuilder) WithYear(v ListFilterIntValuer) *ListFilterBuilder
- func (b *ListFilterBuilder) Year() ListFilterIntValuer
- type ListFilterIntValue
- type ListFilterIntValueRange
- type ListFilterIntValueRanger
- type ListFilterIntValuer
- type Persistence
- type PersistenceOther
Constants ¶
View Source
const ( DAY_INTERVAL = 24 * time.Hour WEEK_INTERVAL = DAY_INTERVAL * 7 )
View Source
const BackupIDTimeFormat = "20060102T150405"
View Source
const DateTimeStringFormat = "2006-01-02 15:04:05.000000"
Variables ¶
This section is empty.
Functions ¶
func FilterTimes ¶
Types ¶
type ArchivedBackuper ¶
type ArchivedBackuper interface {
Backuper
OpenArchive() (io.ReadCloser, error)
}
type Backup ¶
type Backup struct {
OpenFunc func() (io.ReadCloser, error) `json:"-" gorm:"-"`
DetailFunc func(ctx context.Context) string
CreatedAt time.Time
DbName string
Message string
Size int64
Auto bool
}
func (*Backup) GetCreatedAt ¶
func (*Backup) GetMessage ¶
type BackupController ¶
type BackupController interface {
CurrentName(ctx context.Context) (name string, err error)
Create(auto bool, message string) (bkp Backuper, err error)
Remove(id BackupID) error
RemoveOlder(auto bool, p *Persistence) (removed []Backuper, err error)
Get(id BackupID) (Backuper, error)
Download(aw http.ResponseWriter, r *http.Request, id BackupID) (err error)
List(auto bool, cb func(bkp Backuper) error, filter ListFilter) (err error)
Count(auto bool, filter ListFilter) (count int, err error)
}
type BackupsMapper ¶
type BackupsMapper struct {
// contains filtered or unexported fields
}
func Mapper ¶
func Mapper(backups []Backuper) *BackupsMapper
func (*BackupsMapper) Keys ¶
func (b *BackupsMapper) Keys() []time.Time
type DateTimeFilter ¶
type DateTimeRangeFilter ¶
func (DateTimeRangeFilter) MarshalJSON ¶
func (r DateTimeRangeFilter) MarshalJSON() ([]byte, error)
func (DateTimeRangeFilter) Parse ¶
func (v DateTimeRangeFilter) Parse(from, to string) (err error)
type DateTimeValueFilter ¶
func (DateTimeValueFilter) MarshalJSON ¶
func (r DateTimeValueFilter) MarshalJSON() ([]byte, error)
func (*DateTimeValueFilter) Parse ¶
func (v *DateTimeValueFilter) Parse(s string) (err error)
func (DateTimeValueFilter) String ¶
func (v DateTimeValueFilter) String() string
type Group ¶
func GroupByWithFilter ¶
type IntervalGrouper ¶
func (*IntervalGrouper) MustLast ¶
func (i *IntervalGrouper) MustLast(rm func(t []time.Time))
type ListFilter ¶
type ListFilter interface {
Year() ListFilterIntValuer
Month() ListFilterIntValuer
Day() ListFilterIntValuer
Hour() ListFilterIntValuer
DateTime() DateTimeFilter
}
type ListFilterBuilder ¶
type ListFilterBuilder struct {
// contains filtered or unexported fields
}
func NewListFilter ¶
func NewListFilter() *ListFilterBuilder
func (*ListFilterBuilder) DateTime ¶
func (b *ListFilterBuilder) DateTime() DateTimeFilter
func (*ListFilterBuilder) Day ¶
func (b *ListFilterBuilder) Day() ListFilterIntValuer
func (*ListFilterBuilder) Hour ¶
func (b *ListFilterBuilder) Hour() ListFilterIntValuer
func (*ListFilterBuilder) MarshalJSON ¶
func (b *ListFilterBuilder) MarshalJSON() ([]byte, error)
func (*ListFilterBuilder) Month ¶
func (b *ListFilterBuilder) Month() ListFilterIntValuer
func (*ListFilterBuilder) WithDateTime ¶
func (b *ListFilterBuilder) WithDateTime(v DateTimeFilter) *ListFilterBuilder
func (*ListFilterBuilder) WithDay ¶
func (b *ListFilterBuilder) WithDay(v ListFilterIntValuer) *ListFilterBuilder
func (*ListFilterBuilder) WithHour ¶
func (b *ListFilterBuilder) WithHour(v ListFilterIntValuer) *ListFilterBuilder
func (*ListFilterBuilder) WithMonth ¶
func (b *ListFilterBuilder) WithMonth(v ListFilterIntValuer) *ListFilterBuilder
func (*ListFilterBuilder) WithYear ¶
func (b *ListFilterBuilder) WithYear(v ListFilterIntValuer) *ListFilterBuilder
func (*ListFilterBuilder) Year ¶
func (b *ListFilterBuilder) Year() ListFilterIntValuer
type ListFilterIntValue ¶
type ListFilterIntValue int
func (ListFilterIntValue) Valid ¶
func (i ListFilterIntValue) Valid(v int) bool
type ListFilterIntValueRange ¶
type ListFilterIntValueRange [2]int
func (ListFilterIntValueRange) FromValue ¶
func (r ListFilterIntValueRange) FromValue() int
func (ListFilterIntValueRange) ToValue ¶
func (r ListFilterIntValueRange) ToValue() int
func (ListFilterIntValueRange) Valid ¶
func (r ListFilterIntValueRange) Valid(v int) bool
type ListFilterIntValuer ¶
type Persistence ¶
type Persistence struct {
Enabled bool `json:"Enabled,omitempty"`
Years int `json:"Years,omitempty"`
Months int `json:"Months,omitempty"`
Weeks int `json:"Weeks,omitempty"`
Days int `json:"Days,omitempty"`
Other PersistenceOther `json:"Other,omitempty"`
}
func (*Persistence) Group ¶
func (p *Persistence) Group(items []time.Time) (g *IntervalGrouper, other []time.Time)
Group groups sorted items
func (*Persistence) IsZero ¶
func (p *Persistence) IsZero() bool
type PersistenceOther ¶
type PersistenceOther uint8
const ( PersistenceOtherDays PersistenceOther = iota + 1 PersistenceOtherWeeks PersistenceOtherMonths PersistenceOtherYears )
func (*PersistenceOther) Parse ¶
func (o *PersistenceOther) Parse(v string) (err error)
func (PersistenceOther) String ¶
func (o PersistenceOther) String() string
Click to show internal directories.
Click to hide internal directories.