// ClearCommentsRelation clears the 'Comments' relationship for provided models. For relationships of type:
// BelongsTo, HasOne, HasMany if foreign key is not nullable than the function would return an error.
ClearCommentsRelation clears the 'Comments' relationship for provided models. For relationships of type:
BelongsTo, HasOne, HasMany if foreign key is not nullable than the function would return an error.
// ClearCommentsRelation clears the ' Comments ' relationship for provided models . For relationships of type : // BelongsTo HasOne HasMany if foreign key is not nullable than the function would return an error .
func (p *_Posts) ClearCommentsRelation(ctx context.Context, db database.DB, models ...*Post) (int64, error) {
	relation, err := p.Model.RelationByIndex(6)
	if err != nil {
		return 0, err
	}
	modelInterfaces := make([]mapping.Model, len(models))
	for i := range models {
		modelInterfaces[i] = models[i]
	}
	s := query.NewScope(p.Model, modelInterfaces...)
	relationClearer, ok := db.(database.QueryRelationClearer)
	if !ok {
		return 0, errors.WrapDetf(query.ErrInternal, "DB doesn't implement QueryRelationAdder interface - %T", db)
	}
	return relationClearer.QueryClearRelations(ctx, s, relation)
}
func ( p * _Posts ) ClearCommentsRelation ( ctx context . Context , db database . DB , models ... * Post ) ( int64 , error ) { relation , err := p . Model . RelationByIndex ( 6 ) if err != nil { return 0 , err } modelInterfaces := make ( [ ] mapping . Model , len ( models ) ) for i := range models { modelInterfaces [ i ] = models [ i ] } s := query . NewScope ( p . Model , modelInterfaces ... ) relationClearer , ok := db . ( database . QueryRelationClearer ) if ! ok { return 0 , errors . WrapDetf ( query . ErrInternal , " " , db ) } return relationClearer . QueryClearRelations ( ctx , s , relation ) }
ClearCommentsRelation clears the 'Comments' relationship for provided models.
ClearCommentsRelation clears the ' Comments ' relationship for provided models .