// IncludeComments includes given 'relation' in the _Posts query.
// An optional 'relationFieldset' defines the fields to return in the included relation.
IncludeComments includes given 'relation' in the _Posts query.
An optional 'relationFieldset' defines the fields to return in the included relation.
// IncludeComments includes given ' relation ' in the _Posts query . // An optional ' relationFieldset ' defines the fields to return in the included relation .
func (p *postsQueryBuilder) IncludeComments(commentsFieldset ...string) *postsQueryBuilder {
	if p.err != nil {
		return p
	}
	relation, err := NRN_Posts.Model.RelationByIndex(6)
	if err != nil {
		p.err = errors.Wrapf(mapping.ErrInternal, "Getting 'Comments' by index for model 'Post' failed: %v", err)
		return p
	}
	var relationFields []*mapping.StructField
	for _, field := range commentsFieldset {
		structField, ok := relation.ModelStruct().FieldByName(field)
		if !ok {
			p.err = errors.Wrapf(mapping.ErrInvalidModelField, "field: '%s' is not found for the 'Comment' model", field)
			return p
		}
		relationFields = append(relationFields, structField)
	}
	p.builder.Include(relation, relationFields...)
	return p
}
func ( p * postsQueryBuilder ) IncludeComments ( commentsFieldset ... string ) * postsQueryBuilder { if p . err != nil { return p } relation , err := NRN_Posts . Model . RelationByIndex ( 6 ) if err != nil { p . err = errors . Wrapf ( mapping . ErrInternal , " " , err ) return p } var relationFields [ ] * mapping . StructField for _ , field := range commentsFieldset { structField , ok := relation . ModelStruct ( ) . FieldByName ( field ) if ! ok { p . err = errors . Wrapf ( mapping . ErrInvalidModelField , " " , field ) return p } relationFields = append ( relationFields , structField ) } p . builder . Include ( relation , relationFields ... ) return p }
IncludeComments includes given 'relation' in the _Posts query.
IncludeComments includes given ' relation ' in the _Posts query .
// check the fieldset for the relation.