func (qb *tagQueryBuilder) FindAllDescendants(tagID int, excludeIDs []int) ([]*models.TagPath, error) {
	inBinding := getInBinding(len(excludeIDs) + 1)

	query := `WITH RECURSIVE
children AS (
	SELECT t.id AS parent_id, t.id AS child_id, t.name as path FROM tags t WHERE t.id = ?
	UNION
	SELECT tr.parent_id, tr.child_id, c.path || '->' || t.name as path FROM tags_relations tr INNER JOIN children c ON c.child_id = tr.parent_id JOIN tags t ON t.id = tr.child_id WHERE tr.child_id NOT IN` + inBinding + `
)
SELECT t.*, c.path FROM tags t INNER JOIN children c ON t.id = c.child_id
`

	var ret models.TagPaths
	excludeArgs := []interface{}{tagID}
	for _, excludeID := range excludeIDs {
		excludeArgs = append(excludeArgs, excludeID)
	}
	args := []interface{}{tagID}
	args = append(args, append(append(excludeArgs, excludeArgs...), excludeArgs...)...)
	if err := qb.query(query, args, &ret); err != nil {
		return nil, err
	}

	return ret, nil
}
// FindAllDescendants returns a slice of TagPath objects, representing all
// descendants of the tag with the provided id.
FindAllDescendants returns a slice of TagPath objects, representing all
descendants of the tag with the provided id.
// FindAllDescendants returns a slice of TagPath objects representing all // descendants of the tag with the provided id .
func (qb *tagQueryBuilder) FindAllDescendants(tagID int, excludeIDs []int) ([]*models.TagPath, error) {
	inBinding := getInBinding(len(excludeIDs) + 1)
	query := `WITH RECURSIVE
children AS (
	SELECT t.id AS parent_id, t.id AS child_id, t.name as path FROM tags t WHERE t.id = ?
	UNION
	SELECT tr.parent_id, tr.child_id, c.path || '->' || t.name as path FROM tags_relations tr INNER JOIN children c ON c.child_id = tr.parent_id JOIN tags t ON t.id = tr.child_id WHERE tr.child_id NOT IN` + inBinding + `
)
SELECT t.*, c.path FROM tags t INNER JOIN children c ON t.id = c.child_id
`
	var ret models.TagPaths
	excludeArgs := []interface{}{tagID}
	for _, excludeID := range excludeIDs {
		excludeArgs = append(excludeArgs, excludeID)
	}
	args := []interface{}{tagID}
	args = append(args, append(append(excludeArgs, excludeArgs...), excludeArgs...)...)
	if err := qb.query(query, args, &ret); err != nil {
		return nil, err
	}
	return ret, nil
}
func ( qb * tagQueryBuilder ) FindAllDescendants ( tagID int , excludeIDs [ ] int ) ( [ ] * models . TagPath , error ) { inBinding := getInBinding ( len ( excludeIDs ) + 1 ) query := `WITH RECURSIVE
children AS (
	SELECT t.id AS parent_id, t.id AS child_id, t.name as path FROM tags t WHERE t.id = ?
	UNION
	SELECT tr.parent_id, tr.child_id, c.path || '->' || t.name as path FROM tags_relations tr INNER JOIN children c ON c.child_id = tr.parent_id JOIN tags t ON t.id = tr.child_id WHERE tr.child_id NOT IN` + inBinding + `
)
SELECT t.*, c.path FROM tags t INNER JOIN children c ON t.id = c.child_id
` var ret models . TagPaths excludeArgs := [ ] interface { } { tagID } for _ , excludeID := range excludeIDs { excludeArgs = append ( excludeArgs , excludeID ) } args := [ ] interface { } { tagID } args = append ( args , append ( append ( excludeArgs , excludeArgs ... ) , excludeArgs ... ) ... ) if err := qb . query ( query , args , & ret ) ; err != nil { return nil , err } return ret , nil }
FindAllDescendants returns a slice of TagPath objects, representing all
descendants of the tag with the provided id.
FindAllDescendants returns a slice of TagPath objects representing all descendants of the tag with the provided id .