mirror of https://github.com/synctv-org/synctv
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
318 B
Go
19 lines
318 B
Go
package model
|
|
|
|
import "github.com/gin-gonic/gin"
|
|
|
|
type Decoder interface {
|
|
Decode(ctx *gin.Context) error
|
|
Validate() error
|
|
}
|
|
|
|
func Decode(ctx *gin.Context, decoder Decoder) error {
|
|
if err := decoder.Decode(ctx); err != nil {
|
|
return err
|
|
}
|
|
if err := decoder.Validate(); err != nil {
|
|
return err
|
|
}
|
|
return nil
|
|
}
|