// ClearPostsRelation clears the 'Posts' relationship for provided models. For relationships of type:
// BelongsTo, HasOne, HasMany if foreign key is not nullable than the function would return an error.
ClearPostsRelation clears the 'Posts' relationship for provided models. For relationships of type:
BelongsTo, HasOne, HasMany if foreign key is not nullable than the function would return an error.
// ClearPostsRelation clears the ' Posts ' 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 (b *_Blogs) ClearPostsRelation(ctx context.Context, db database.DB, models ...*Blog) (int64, error) {
	relation, err := b.Model.RelationByIndex(3)
	if err != nil {
		return 0, err
	}
	modelInterfaces := make([]mapping.Model, len(models))
	for i := range models {
		modelInterfaces[i] = models[i]
	}
	s := query.NewScope(b.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 ( b * _Blogs ) ClearPostsRelation ( ctx context . Context , db database . DB , models ... * Blog ) ( int64 , error ) { relation , err := b . Model . RelationByIndex ( 3 ) if err != nil { return 0 , err } modelInterfaces := make ( [ ] mapping . Model , len ( models ) ) for i := range models { modelInterfaces [ i ] = models [ i ] } s := query . NewScope ( b . Model , modelInterfaces ... ) relationClearer , ok := db . ( database . QueryRelationClearer ) if ! ok { return 0 , errors . WrapDetf ( query . ErrInternal , " " , db ) } return relationClearer . QueryClearRelations ( ctx , s , relation ) }
ClearPostsRelation clears the 'Posts' relationship for provided models.
ClearPostsRelation clears the ' Posts ' relationship for provided models .