func (d *Deck) Validate() error {
	if d.ID == "" {
		return errors.New("id required")
	}
	if err := validateDocID(d.ID); err != nil {
		return err
	}
	if !strings.HasPrefix(d.ID, "deck-") {
		return errors.New("incorrect doc type")
	}
	if d.Created.IsZero() {
		return errors.New("created time required")
	}
	if d.Modified.IsZero() {
		return errors.New("modified time required")
	}
	if d.Cards == nil {
		return errors.New("collection is nil")
	}
	if err := d.Cards.Validate(); err != nil {
		return err
	}
	return nil
}
// Validate validates that all of the data in the deck appears valid and
// self consistent. A nil return value means no errors were detected.
Validate validates that all of the data in the deck appears valid and
self consistent. A nil return value means no errors were detected.
// Validate validates that all of the data in the deck appears valid and // self consistent . A nil return value means no errors were detected .
func (d *Deck) Validate() error {
	if d.ID == "" {
		return errors.New("id required")
	}
	if err := validateDocID(d.ID); err != nil {
		return err
	}
	if !strings.HasPrefix(d.ID, "deck-") {
		return errors.New("incorrect doc type")
	}
	if d.Created.IsZero() {
		return errors.New("created time required")
	}
	if d.Modified.IsZero() {
		return errors.New("modified time required")
	}
	if d.Cards == nil {
		return errors.New("collection is nil")
	}
	if err := d.Cards.Validate(); err != nil {
		return err
	}
	return nil
}
func ( d * Deck ) Validate ( ) error { if d . ID == " " { return errors . New ( " " ) } if err := validateDocID ( d . ID ) ; err != nil { return err } if ! strings . HasPrefix ( d . ID , " " ) { return errors . New ( " " ) } if d . Created . IsZero ( ) { return errors . New ( " " ) } if d . Modified . IsZero ( ) { return errors . New ( " " ) } if d . Cards == nil { return errors . New ( " " ) } if err := d . Cards . Validate ( ) ; err != nil { return err } return nil }
Validate validates that all of the data in the deck appears valid and
self consistent.
Validate validates that all of the data in the deck appears valid and self consistent .