// RemoveFilteredPolicy removes policy rules that match the filter from the storage.
RemoveFilteredPolicy removes policy rules that match the filter from the storage.
// RemoveFilteredPolicy removes policy rules that match the filter from the storage .
func (a *adapter) RemoveFilteredPolicy(sec string, ptype string, fieldIndex int, fieldValues ...string) error {
	selector := make(map[string]interface{})
	selector["ptype"] = ptype
	if fieldIndex <= 0 && 0 < fieldIndex+len(fieldValues) {
		if fieldValues[0-fieldIndex] != "" {
			selector["v0"] = fieldValues[0-fieldIndex]
		}
	}
	if fieldIndex <= 1 && 1 < fieldIndex+len(fieldValues) {
		if fieldValues[1-fieldIndex] != "" {
			selector["v1"] = fieldValues[1-fieldIndex]
		}
	}
	if fieldIndex <= 2 && 2 < fieldIndex+len(fieldValues) {
		if fieldValues[2-fieldIndex] != "" {
			selector["v2"] = fieldValues[2-fieldIndex]
		}
	}
	if fieldIndex <= 3 && 3 < fieldIndex+len(fieldValues) {
		if fieldValues[3-fieldIndex] != "" {
			selector["v3"] = fieldValues[3-fieldIndex]
		}
	}
	if fieldIndex <= 4 && 4 < fieldIndex+len(fieldValues) {
		if fieldValues[4-fieldIndex] != "" {
			selector["v4"] = fieldValues[4-fieldIndex]
		}
	}
	if fieldIndex <= 5 && 5 < fieldIndex+len(fieldValues) {
		if fieldValues[5-fieldIndex] != "" {
			selector["v5"] = fieldValues[5-fieldIndex]
		}
	}
	ctx, cancle := context.WithTimeout(context.TODO(), a.timeout)
	defer cancle()
	if _, err := a.collection.DeleteMany(ctx, selector); err != nil {
		return err
	}
	return nil
}
func ( a * adapter ) RemoveFilteredPolicy ( sec string , ptype string , fieldIndex int , fieldValues ... string ) error { selector := make ( map [ string ] interface { } ) selector [ " " ] = ptype if fieldIndex <= 0 && 0 < fieldIndex + len ( fieldValues ) { if fieldValues [ 0 - fieldIndex ] != " " { selector [ " " ] = fieldValues [ 0 - fieldIndex ] } } if fieldIndex <= 1 && 1 < fieldIndex + len ( fieldValues ) { if fieldValues [ 1 - fieldIndex ] != " " { selector [ " " ] = fieldValues [ 1 - fieldIndex ] } } if fieldIndex <= 2 && 2 < fieldIndex + len ( fieldValues ) { if fieldValues [ 2 - fieldIndex ] != " " { selector [ " " ] = fieldValues [ 2 - fieldIndex ] } } if fieldIndex <= 3 && 3 < fieldIndex + len ( fieldValues ) { if fieldValues [ 3 - fieldIndex ] != " " { selector [ " " ] = fieldValues [ 3 - fieldIndex ] } } if fieldIndex <= 4 && 4 < fieldIndex + len ( fieldValues ) { if fieldValues [ 4 - fieldIndex ] != " " { selector [ " " ] = fieldValues [ 4 - fieldIndex ] } } if fieldIndex <= 5 && 5 < fieldIndex + len ( fieldValues ) { if fieldValues [ 5 - fieldIndex ] != " " { selector [ " " ] = fieldValues [ 5 - fieldIndex ] } } ctx , cancle := context . WithTimeout ( context . TODO ( ) , a . timeout ) defer cancle ( ) if _ , err := a . collection . DeleteMany ( ctx , selector ) ; err != nil { return err } return nil }
RemoveFilteredPolicy removes policy rules that match the filter from the storage.
RemoveFilteredPolicy removes policy rules that match the filter from the storage .