{"modulePath":"github.com/oapi-codegen/runtime","version":"v1.9.1","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package types\n\n## Constants\n\n```go\nconst DateFormat = \"2006-01-02\"\n```\n\n## Variables\n\n```go\nvar ErrValidationEmail = errors.New(\"email: failed to pass regex validation\")\n```\nErrValidationEmail is the sentinel error returned when an email fails validation\n\n## Types\n\n```go\ntype Date struct {\n\ttime.Time\n}\n```\n\n```go\nfunc (d *Date) Bind(src string) error\n```\nBind implements the runtime.Binder interface so that Date is treated as a scalar value when binding query parameters rather than being decomposed as a struct with key-value pairs.\n\n```go\nfunc (d Date) MarshalJSON() ([]byte, error)\n```\n\n```go\nfunc (d Date) MarshalText() ([]byte, error)\n```\n\n```go\nfunc (d Date) String() string\n```\n\n```go\nfunc (d *Date) UnmarshalJSON(data []byte) error\n```\n\n```go\nfunc (d *Date) UnmarshalText(data []byte) error\n```\n\n```go\ntype Duration struct {\n\tYears  int\n\tMonths int\n\tWeeks  int\n\tDays   int\n\n\tHours   int\n\tMinutes int\n\t// Seconds may carry a fraction (e.g. \"PT0.5S\"). Strictly, RFC 3339\n\t// allows only integer components; ISO 8601 permits a fraction on the\n\t// smallest component, and real-world payloads use it, so fractional\n\t// seconds are accepted when parsing and emitted when present.\n\tSeconds float64\n}\n```\nDuration represents an RFC 3339 duration (the ISO 8601 duration grammar referenced by the OpenAPI \"duration\" format), e.g. \"P3Y6M4DT12H30M5S\". See [https://spec.openapis.org/registry/format/duration](https://spec.openapis.org/registry/format/duration)\n\nCalendar components (years, months, weeks, days) have no fixed length in wall-clock time, so the components are stored as parsed instead of being converted to a time.Duration; any spec-valid duration round-trips losslessly through ParseDuration and String. Use TimeDuration and FromTimeDuration to bridge to time.Duration where the conversion is well-defined.\n\nThe RFC 3339 grammar makes weeks exclusive (\"P2W\" cannot be combined with other components); ParseDuration enforces that, but the struct cannot. A hand-built value mixing Weeks with other components serializes with the week between the months and days, which is outside the strict grammar.\n\n```go\nfunc FromTimeDuration(td time.Duration) (Duration, error)\n```\nFromTimeDuration decomposes a time.Duration into hours, minutes and seconds. RFC 3339 durations cannot be negative, so a negative input is an error.\n\n```go\nfunc ParseDuration(s string) (Duration, error)\n```\nParseDuration parses an RFC 3339 duration string per the grammar in RFC 3339 appendix A: \"P\" followed by ordered date components (\"1Y2M3D\"), a time part introduced by \"T\" (\"T4H5M6S\"), or a standalone week component (\"2W\"). At least one component must be present. As an interoperability extension beyond the strict grammar, the seconds component may carry a fraction, with either a period or a comma (\"PT0.5S\", \"PT0,5S\").\n\n```go\nfunc (d *Duration) Bind(src string) error\n```\nBind implements the runtime.Binder interface so that Duration is treated as a scalar value when binding parameters rather than being decomposed as a struct with key-value pairs.\n\n```go\nfunc (d Duration) MarshalJSON() ([]byte, error)\n```\n\n```go\nfunc (d Duration) MarshalText() ([]byte, error)\n```\n\n```go\nfunc (d Duration) String() string\n```\nString serializes the duration in RFC 3339 form, omitting zero components. The all-zero duration serializes as \"PT0S\".\n\n```go\nfunc (d Duration) TimeDuration() (time.Duration, error)\n```\nTimeDuration converts to a time.Duration. Years and months have no fixed length, so their presence is an error; weeks and days are converted with the common fixed convention of 7-day weeks and 24-hour days, which ignores calendar effects such as DST transitions.\n\n```go\nfunc (d *Duration) UnmarshalJSON(data []byte) error\n```\n\n```go\nfunc (d *Duration) UnmarshalText(data []byte) error\n```\n\n```go\ntype Email string\n```\nEmail represents an email address. It is a string type that must pass regex validation before being marshalled to JSON or unmarshalled from JSON.\n\n```go\nfunc (e Email) MarshalJSON() ([]byte, error)\n```\n\n```go\nfunc (e *Email) UnmarshalJSON(data []byte) error\n```\n\n```go\ntype File struct {\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc (file File) Bytes() ([]byte, error)\n```\n\n```go\nfunc (file File) FileSize() int64\n```\n\n```go\nfunc (file File) Filename() string\n```\n\n```go\nfunc (file *File) InitFromBytes(data []byte, filename string)\n```\n\n```go\nfunc (file *File) InitFromMultipart(header *multipart.FileHeader)\n```\n\n```go\nfunc (file File) MarshalJSON() ([]byte, error)\n```\n\n```go\nfunc (file File) Reader() (io.ReadCloser, error)\n```\n\n```go\nfunc (file *File) UnmarshalJSON(data []byte) error\n```\n\n```go\ntype UUID = uuid.UUID\n```\n\n","path":"github.com/oapi-codegen/runtime/types","name":"types","synopsis":"","isRedistributable":true}
