2017-11-02 04:50:56 +01:00
|
|
|
# Domain Models
|
|
|
|
|
|
|
|
There should be the domain/business-level models.
|
|
|
|
|
|
|
|
Example:
|
|
|
|
|
|
|
|
```go
|
2019-10-25 00:27:02 +02:00
|
|
|
import "github.com/kataras/iris/v12/_examples/mvc/overview/datamodels"
|
2017-11-02 04:50:56 +01:00
|
|
|
|
|
|
|
type Movie struct {
|
|
|
|
datamodels.Movie
|
|
|
|
}
|
|
|
|
|
|
|
|
func (m Movie) Validate() (Movie, error) {
|
|
|
|
/* do some checks and return an error if that Movie is not valid */
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
However, we will use the "datamodels" as the only one models package because
|
2017-10-12 02:51:06 +02:00
|
|
|
Movie structure we don't need any extra functionality or validation inside it.
|