func (v *Volume) BeforeInsert() error {
	v.CreatedAt = time.Now().UTC().Truncate(time.Second)
	v.UpdatedAt = v.CreatedAt
	return nil
}
BeforeInsert set CreatedAt and UpdatedAt.
package models
import (
	"time"
)
const (
	VolumePaper   = "paperbook"
	VolumeElectro = "ebook"
	VolumeAudio   = "audiobook"
)
func GetVolumes() []string {
	volumes := []string{VolumeAudio, VolumeElectro, VolumePaper}
	return volumes
}
func CheckVolume(volume string) bool {
	switch volume {
	case VolumePaper:
	case VolumeElectro:
	case VolumeAudio:
	default:
		return false
	}
	return true
}
type Volume struct {
	ID        int32     `reform:"id,pk"`
	BookID    int32     `reform:"book_id"`
	Type      string    `reform:"type"`
	CreatedAt time.Time `reform:"created_at"`
	UpdatedAt time.Time `reform:"updated_at"`
}