Source File
date.go
Belonging Package
github.com/oapi-codegen/runtime/types
package types
import (
)
const DateFormat = "2006-01-02"
type Date struct {
time.Time
}
func ( Date) () ([]byte, error) {
return json.Marshal(.Time.Format(DateFormat))
}
func ( *Date) ( []byte) error {
var string
:= json.Unmarshal(, &)
if != nil {
return
}
, := time.Parse(DateFormat, )
if != nil {
return
}
.Time =
return nil
}
func ( Date) () string {
return .Time.Format(DateFormat)
}
func ( *Date) ( []byte) error {
, := time.Parse(DateFormat, string())
if != nil {
return
}
.Time =
return nil
}
![]() |
The pages are generated with Golds v0.7.6. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |