Documentation
¶
Index ¶
- Constants
- func FileTVRreadByte(filePath string) ([]byte, error)
- func FileTVRreadByteIO(file io.Reader) ([]byte, error)
- func FileTVRwrite(ruleObj *TimeConfigurationRulesObj, dirPath string, fileName string) error
- func FileTVRwriteByte(ruleObj *TimeConfigurationRulesObj) ([]byte, error)
- func FileWrite(ruleObj *TimeConfigurationRulesObj, dirPath string, ex fileEx) error
- func JSONwrite(ruleObj *TimeConfigurationRulesObj, dirPath string, fileName string) error
- func JSONwriteByte(ruleObj *TimeConfigurationRulesObj) ([]byte, error)
- func JSONwritePretty(ruleObj *TimeConfigurationRulesObj, dirPath string, fileName string) error
- func JSONwritePrettyByte(ruleObj *TimeConfigurationRulesObj) ([]byte, error)
- type DateObj
- type DateTimeObj
- type FF
- type FormatsInfoObj
- type MonthObj
- type SystemInfoObj
- type TimeConfigurationRulesObj
- func DefRules() (TimeConfigurationRulesObj, error)
- func FileRead(filePath string) (TimeConfigurationRulesObj, error)
- func FileReadIO(file io.Reader, ex fileEx) (TimeConfigurationRulesObj, error)
- func FileTVRread(filePath string) (TimeConfigurationRulesObj, error)
- func FileTVRreadIO(file io.Reader) (TimeConfigurationRulesObj, error)
- func JSONread(filePath string) (TimeConfigurationRulesObj, error)
- func JSONreadIO(file io.Reader) (TimeConfigurationRulesObj, error)
- func (obj *TimeConfigurationRulesObj) CheckErrors() (errors []string)
- func (obj *TimeConfigurationRulesObj) Date(year int64, month uint16, day uint16) DateObj
- func (obj *TimeConfigurationRulesObj) DateFull(year int64, month uint16, day uint16, timezone string) DateTimeObj
- func (obj *TimeConfigurationRulesObj) DateTime(dateObj DateObj, timeObj TimeObj, timezone string) DateTimeObj
- func (obj *TimeConfigurationRulesObj) DateTimeToMinutes(dateObj DateObj, timeObj TimeObj) *big.Int
- func (obj *TimeConfigurationRulesObj) Format(dateTime *DateTimeObj, layout string) (text string)
- func (obj *TimeConfigurationRulesObj) LocationSet(DateTime DateTimeObj, timezone string) (dateTime DateTimeObj, err error)
- func (v TimeConfigurationRulesObj) MarshalEasyJSON(w *jwriter.Writer)
- func (v TimeConfigurationRulesObj) MarshalJSON() ([]byte, error)
- func (obj *TimeConfigurationRulesObj) MinutesToDate(totalMinutes *big.Int) (dateObj DateObj, timeObj TimeObj)
- func (obj *TimeConfigurationRulesObj) MonthFull(date *DateObj) string
- func (obj *TimeConfigurationRulesObj) MonthShort(date *DateObj) string
- func (obj *TimeConfigurationRulesObj) StringDate(date DateObj) string
- func (obj *TimeConfigurationRulesObj) StringDateTime(dateTime DateTimeObj) string
- func (obj *TimeConfigurationRulesObj) StringTime(time TimeObj) string
- func (obj *TimeConfigurationRulesObj) Time(hour uint16, minute uint16) TimeObj
- func (obj *TimeConfigurationRulesObj) TimezoneList() []string
- func (v *TimeConfigurationRulesObj) UnmarshalEasyJSON(l *jlexer.Lexer)
- func (v *TimeConfigurationRulesObj) UnmarshalJSON(data []byte) error
- func (obj *TimeConfigurationRulesObj) Valid(tvr *DateTimeObj) error
- type TimeObj
- type YearLimitsObj
Constants ¶
Variables ¶
This section is empty.
Functions ¶
func FileTVRreadByte ¶
Парсинг правила из файла с расширением fileExTVR в массив байт
func FileTVRreadByteIO ¶
Парсинг правила из бинарого представления фала с расширением fileExTVR в массив байт
func FileTVRwrite ¶
func FileTVRwrite(ruleObj *TimeConfigurationRulesObj, dirPath string, fileName string) error
Запись правила в файл с расширением fileExTVR
func FileTVRwriteByte ¶
func FileTVRwriteByte(ruleObj *TimeConfigurationRulesObj) ([]byte, error)
Запись правила в файл с расширением fileExTVR в массив байт
func FileWrite ¶
func FileWrite(ruleObj *TimeConfigurationRulesObj, dirPath string, ex fileEx) error
Запись правила в файл с указаным расширением
func JSONwrite ¶
func JSONwrite(ruleObj *TimeConfigurationRulesObj, dirPath string, fileName string) error
Запись правила в json-файл
func JSONwriteByte ¶
func JSONwriteByte(ruleObj *TimeConfigurationRulesObj) ([]byte, error)
Запись правила в json
func JSONwritePretty ¶
func JSONwritePretty(ruleObj *TimeConfigurationRulesObj, dirPath string, fileName string) error
Запись правила в json-файл с отступами
func JSONwritePrettyByte ¶
func JSONwritePrettyByte(ruleObj *TimeConfigurationRulesObj) ([]byte, error)
Запись правила в json с отступами
Types ¶
type DateObj ¶
type DateObj struct { Year int64 `json:"year"` //< Год Month uint16 `json:"month"` //< Месяц Day uint16 `json:"day"` //< День }
DateObj Группа даты
func (DateObj) MarshalEasyJSON ¶
MarshalEasyJSON supports easyjson.Marshaler interface
func (DateObj) MarshalJSON ¶
MarshalJSON supports json.Marshaler interface
func (*DateObj) UnmarshalEasyJSON ¶
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*DateObj) UnmarshalJSON ¶
UnmarshalJSON supports json.Unmarshaler interface
type DateTimeObj ¶
type DateTimeObj struct { Type string `json:"type"` //< Тип календаря Date DateObj `json:"date"` //< Дата Time TimeObj `json:"time"` //< Время Timezone string `json:"timezone"` //< Таймзона для расчета смещения }
Структура универсальной точки времени
func (DateTimeObj) MarshalEasyJSON ¶
func (v DateTimeObj) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (DateTimeObj) MarshalJSON ¶
func (v DateTimeObj) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (DateTimeObj) String ¶
func (obj DateTimeObj) String() string
func (*DateTimeObj) UnmarshalEasyJSON ¶
func (v *DateTimeObj) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*DateTimeObj) UnmarshalJSON ¶
func (v *DateTimeObj) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type FormatsInfoObj ¶
type FormatsInfoObj struct { Date string `json:"date"` // Представление даты Time string `json:"time"` // Представление времени Full string `json:"full"` // Представление временного объекта }
func (FormatsInfoObj) MarshalEasyJSON ¶
func (v FormatsInfoObj) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (FormatsInfoObj) MarshalJSON ¶
func (v FormatsInfoObj) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*FormatsInfoObj) UnmarshalEasyJSON ¶
func (v *FormatsInfoObj) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*FormatsInfoObj) UnmarshalJSON ¶
func (v *FormatsInfoObj) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type MonthObj ¶
type MonthObj struct { FullName string `json:"fullName"` // Полноное название месяца ShortName string `json:"shortName"` // Сокращенное название месяца латиницей Days uint16 `json:"days"` // Количество дней в месяце }
MonthObj Обьект месяца
func (MonthObj) MarshalEasyJSON ¶
MarshalEasyJSON supports easyjson.Marshaler interface
func (MonthObj) MarshalJSON ¶
MarshalJSON supports json.Marshaler interface
func (*MonthObj) UnmarshalEasyJSON ¶
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*MonthObj) UnmarshalJSON ¶
UnmarshalJSON supports json.Unmarshaler interface
type SystemInfoObj ¶
type SystemInfoObj struct { Ver string `json:"ver"` // Версия файла. Для отслеживания изменений по файлу Creator string `json:"creator"` // Имя\логин\иное создателя\редактора }
SystemInfoObj Системная информация по объекту
func (SystemInfoObj) MarshalEasyJSON ¶
func (v SystemInfoObj) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (SystemInfoObj) MarshalJSON ¶
func (v SystemInfoObj) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*SystemInfoObj) UnmarshalEasyJSON ¶
func (v *SystemInfoObj) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*SystemInfoObj) UnmarshalJSON ¶
func (v *SystemInfoObj) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type TimeConfigurationRulesObj ¶
type TimeConfigurationRulesObj struct { Name string `json:"name"` //< Уникальное название правила Description string `json:"description"` //< Описание правила INF SystemInfoObj `json:"inf"` //< Системная информация по файлу FormatsDef FormatsInfoObj `json:"format"` //< Форматирование строчного представления даты по умолчанию Year YearLimitsObj `json:"year"` //< Годовые ограничения MaxHour uint16 `json:"maxHour"` //< Максимальное количество часов в дне MaxMin uint16 `json:"maxMin"` //< Максимальное количество минут в часе Month []MonthObj `json:"month"` //< Массив месяцев. Порядок важен DaysInYear uint64 `json:"daysInYear"` //< Дней в году (автоматически генерируется из месяцев) Timezones map[string]int64 `json:"timezones"` //< Уникальные часовые зоны со смещением в минутах }
Базовая стукрута конфигурации времени
func DefRules ¶
func DefRules() (TimeConfigurationRulesObj, error)
Получение структуры времени 'по умолчанию' (встроена в библиотеку)
func FileRead ¶
func FileRead(filePath string) (TimeConfigurationRulesObj, error)
Парсинг правила из файла
func FileReadIO ¶
func FileReadIO(file io.Reader, ex fileEx) (TimeConfigurationRulesObj, error)
Парсинг правила из бинарого представления фала
func FileTVRread ¶
func FileTVRread(filePath string) (TimeConfigurationRulesObj, error)
Парсинг правила из файла с расширением fileExTVR
func FileTVRreadIO ¶
func FileTVRreadIO(file io.Reader) (TimeConfigurationRulesObj, error)
Парсинг правила из бинарого представления фала с расширением fileExTVR
func JSONread ¶
func JSONread(filePath string) (TimeConfigurationRulesObj, error)
Парсинг правила из json
func JSONreadIO ¶
func JSONreadIO(file io.Reader) (TimeConfigurationRulesObj, error)
Парсинг правила из бинарого представления json
func (*TimeConfigurationRulesObj) CheckErrors ¶
func (obj *TimeConfigurationRulesObj) CheckErrors() (errors []string)
Проверяет структуру на синтаксические ошибки
func (*TimeConfigurationRulesObj) Date ¶
func (obj *TimeConfigurationRulesObj) Date(year int64, month uint16, day uint16) DateObj
Создание только даты (автоформатирование если зашли за пределы)
func (*TimeConfigurationRulesObj) DateFull ¶
func (obj *TimeConfigurationRulesObj) DateFull(year int64, month uint16, day uint16, timezone string) DateTimeObj
Создание точки времени напрямую
func (*TimeConfigurationRulesObj) DateTime ¶
func (obj *TimeConfigurationRulesObj) DateTime(dateObj DateObj, timeObj TimeObj, timezone string) DateTimeObj
Создание точки времени (никаких проверок)
func (*TimeConfigurationRulesObj) DateTimeToMinutes ¶
func (obj *TimeConfigurationRulesObj) DateTimeToMinutes(dateObj DateObj, timeObj TimeObj) *big.Int
Перевод даты в число минут
func (*TimeConfigurationRulesObj) Format ¶
func (obj *TimeConfigurationRulesObj) Format(dateTime *DateTimeObj, layout string) (text string)
Вывод форматированной даты
func (*TimeConfigurationRulesObj) LocationSet ¶
func (obj *TimeConfigurationRulesObj) LocationSet(DateTime DateTimeObj, timezone string) (dateTime DateTimeObj, err error)
Изменение таймзоны со смешением временных диапазонов
func (TimeConfigurationRulesObj) MarshalEasyJSON ¶
func (v TimeConfigurationRulesObj) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (TimeConfigurationRulesObj) MarshalJSON ¶
func (v TimeConfigurationRulesObj) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*TimeConfigurationRulesObj) MinutesToDate ¶
func (obj *TimeConfigurationRulesObj) MinutesToDate(totalMinutes *big.Int) (dateObj DateObj, timeObj TimeObj)
Перевод числа минут в дату
func (*TimeConfigurationRulesObj) MonthFull ¶
func (obj *TimeConfigurationRulesObj) MonthFull(date *DateObj) string
Полное название месяца человеко-понятно
func (*TimeConfigurationRulesObj) MonthShort ¶
func (obj *TimeConfigurationRulesObj) MonthShort(date *DateObj) string
Сокращенное название месяца
func (*TimeConfigurationRulesObj) StringDate ¶
func (obj *TimeConfigurationRulesObj) StringDate(date DateObj) string
Вывод даты по умолчанию
func (*TimeConfigurationRulesObj) StringDateTime ¶
func (obj *TimeConfigurationRulesObj) StringDateTime(dateTime DateTimeObj) string
Вывод по умолчанию
func (*TimeConfigurationRulesObj) StringTime ¶
func (obj *TimeConfigurationRulesObj) StringTime(time TimeObj) string
Вывод времени по умолчанию
func (*TimeConfigurationRulesObj) Time ¶
func (obj *TimeConfigurationRulesObj) Time(hour uint16, minute uint16) TimeObj
Создание только времени (автоформатирование если зашли за пределы)
func (*TimeConfigurationRulesObj) TimezoneList ¶
func (obj *TimeConfigurationRulesObj) TimezoneList() []string
Получение списка всех доступных таймзон
func (*TimeConfigurationRulesObj) UnmarshalEasyJSON ¶
func (v *TimeConfigurationRulesObj) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*TimeConfigurationRulesObj) UnmarshalJSON ¶
func (v *TimeConfigurationRulesObj) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
func (*TimeConfigurationRulesObj) Valid ¶
func (obj *TimeConfigurationRulesObj) Valid(tvr *DateTimeObj) error
Проверка времени на соответствие стандартам
type TimeObj ¶
TimeObj Группа времени
func (TimeObj) MarshalEasyJSON ¶
MarshalEasyJSON supports easyjson.Marshaler interface
func (TimeObj) MarshalJSON ¶
MarshalJSON supports json.Marshaler interface
func (*TimeObj) UnmarshalEasyJSON ¶
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*TimeObj) UnmarshalJSON ¶
UnmarshalJSON supports json.Unmarshaler interface
type YearLimitsObj ¶
type YearLimitsObj struct { Min int64 `json:"min"` // Минимально допустимый год Max int64 `json:"max"` // Максимально допустимый год }
YearLimitsObj Лимит времени в годах
func (YearLimitsObj) MarshalEasyJSON ¶
func (v YearLimitsObj) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (YearLimitsObj) MarshalJSON ¶
func (v YearLimitsObj) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*YearLimitsObj) UnmarshalEasyJSON ¶
func (v *YearLimitsObj) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*YearLimitsObj) UnmarshalJSON ¶
func (v *YearLimitsObj) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface