github.com/circl-dev/go-swagger@v0.31.0/examples/external-types/models/embedded_time.go (about) 1 // Code generated by go-swagger; DO NOT EDIT. 2 3 package models 4 5 // This file was generated by the swagger tool. 6 // Editing this file might prove futile when you re-run the swagger generate command 7 8 import ( 9 "context" 10 timeext "time" 11 12 "github.com/go-openapi/strfmt" 13 "github.com/circl-dev/runtime" 14 ) 15 16 // EmbeddedTime 17 // This type demonstrates how we can embed an external type and wraps the validation. 18 // 19 // This is especially useful if you want to reuse some types from the standard library, 20 // such as `time.Time` or `json.RawMessage`. 21 // 22 // 23 // swagger:model EmbeddedTime 24 type EmbeddedTime struct { 25 timeext.Time 26 } 27 28 func (m EmbeddedTime) Validate(formats strfmt.Registry) error { 29 var f interface{} = m.Time 30 if v, ok := f.(runtime.Validatable); ok { 31 return v.Validate(formats) 32 } 33 return nil 34 } 35 36 func (m EmbeddedTime) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 37 var f interface{} = m.Time 38 if v, ok := f.(runtime.ContextValidatable); ok { 39 return v.ContextValidate(ctx, formats) 40 } 41 return nil 42 }