Documentation
¶
Index ¶
- Constants
- Variables
- func ActiveHoursRangeString(from, to byte) string
- type Hours
- func (h Hours) Clone() Hours
- func (h Hours) Equal(h2 Hours) bool
- func (h Hours) IsAllActive() bool
- func (h Hours) IsNoActive() bool
- func (h Hours) MarshalJSON() ([]byte, error)
- func (h Hours) MarshalYAML() (any, error)
- func (h Hours) Merge(h2 Hours)
- func (h *Hours) Scan(value any) (err error)
- func (h *Hours) SetHour(weekDay time.Weekday, hour byte, active bool)
- func (h Hours) String() string
- func (h Hours) TestHour(weekDay time.Weekday, hour byte) bool
- func (h Hours) TestTime(t time.Time) bool
- func (h *Hours) UnmarshalJSON(data []byte) error
- func (h *Hours) UnmarshalYAML(node *yaml.Node) error
- func (h Hours) Value() (driver.Value, error)
- type HoursObject
- func (h HoursObject) Clone() HoursObject
- func (h HoursObject) Equal(h2 Hours) bool
- func (h HoursObject) IsAllActive() bool
- func (h HoursObject) IsNoActive() bool
- func (h HoursObject) MarshalJSON() ([]byte, error)
- func (h HoursObject) MarshalYAML() (any, error)
- func (h HoursObject) Merge(h2 Hours)
- func (h *HoursObject) Scan(value any) (err error)
- func (h *HoursObject) SetHour(weekDay time.Weekday, hour byte, active bool)
- func (h HoursObject) String() string
- func (h HoursObject) TestHour(weekDay time.Weekday, hour byte) bool
- func (h HoursObject) TestTime(t time.Time) bool
- func (h *HoursObject) UnmarshalJSON(data []byte) error
- func (h *HoursObject) UnmarshalYAML(node *yaml.Node) error
- func (h HoursObject) Value() (driver.Value, error)
Constants ¶
const ( ActiveDayHoursString = "111111111111111111111111" DisabledDayHoursString = "000000000000000000000000" AllActiveHoursString = "*" // default value to save the space ActiveWeekHoursString = "" + ActiveDayHoursString + ActiveDayHoursString + ActiveDayHoursString + ActiveDayHoursString + ActiveDayHoursString + ActiveDayHoursString + ActiveDayHoursString // Saturday )
Default constants...
Variables ¶
var ErrTooMuchHoursForDecode = errors.New("[hours] too much hours for decode, mpre then 24*7")
ErrTooMuchHoursForDecode tells that hours more then for a week
Functions ¶
func ActiveHoursRangeString ¶
ActiveHoursRangeString returns preformatted string with marked active houts according to range
Types ¶
type Hours ¶
type Hours []byte
Hours type
func HoursByJSON ¶
HoursByJSON decodes JSON format of timetable
func HoursByString ¶
HoursByString returns hours value or error
func MustHoursByString ¶
MustHoursByString returns hours value or panic
func (Hours) MarshalJSON ¶
MarshalJSON implements the functionality of json.Marshaler interface
func (Hours) MarshalYAML ¶
MarshalYAML implements the functionality of yaml.Marshaler interface
func (*Hours) UnmarshalJSON ¶
UnmarshalJSON implements the functionality of json.Unmarshaler interface
func (*Hours) UnmarshalYAML ¶
UnmarshalYAML implements the functionality of yaml.Unmarshaler interface
type HoursObject ¶
type HoursObject Hours
HoursObject supports the JSON format of storing
func (HoursObject) Clone ¶
func (h HoursObject) Clone() HoursObject
Clone returns a copy of HoursObject
func (HoursObject) Equal ¶
func (h HoursObject) Equal(h2 Hours) bool
Equal comarison of two hour tables
func (HoursObject) IsAllActive ¶
func (h HoursObject) IsAllActive() bool
IsAllActive then return the true
func (HoursObject) IsNoActive ¶
func (h HoursObject) IsNoActive() bool
IsNoActive then return the true
func (HoursObject) MarshalJSON ¶
func (h HoursObject) MarshalJSON() ([]byte, error)
MarshalJSON implements the functionality of json.Marshaler interface
func (HoursObject) MarshalYAML ¶
func (h HoursObject) MarshalYAML() (any, error)
MarshalYAML implements the functionality of yaml.Marshaler interface
func (*HoursObject) Scan ¶
func (h *HoursObject) Scan(value any) (err error)
Scan - Implement the database/sql scanner interface
func (*HoursObject) SetHour ¶
func (h *HoursObject) SetHour(weekDay time.Weekday, hour byte, active bool)
SetHour as active or no
func (HoursObject) String ¶
func (h HoursObject) String() string
String implementation of fmt.Stringer
func (HoursObject) TestHour ¶
func (h HoursObject) TestHour(weekDay time.Weekday, hour byte) bool
TestHour hour
func (*HoursObject) UnmarshalJSON ¶
func (h *HoursObject) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the functionality of json.Unmarshaler interface
func (*HoursObject) UnmarshalYAML ¶
func (h *HoursObject) UnmarshalYAML(node *yaml.Node) error
UnmarshalYAML implements the functionality of yaml.Unmarshaler interface