Skip to content
This repository has been archived by the owner on Nov 14, 2020. It is now read-only.

Commit

Permalink
postgresql_role: Add roles attribute.
Browse files Browse the repository at this point in the history
* This allows to grant roles to the role we are managing.
  • Loading branch information
cyrilgdn committed Dec 5, 2018
1 parent 47597c8 commit c8d5737
Show file tree
Hide file tree
Showing 3 changed files with 253 additions and 76 deletions.
11 changes: 11 additions & 0 deletions postgresql/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ package postgresql
import (
"fmt"
"strings"

"github.com/hashicorp/terraform/helper/schema"
"github.com/lib/pq"
)

// pqQuoteLiteral returns a string literal safe for inclusion in a PostgreSQL
Expand All @@ -22,3 +25,11 @@ func validateConnLimit(v interface{}, key string) (warnings []string, errors []e
}
return
}

func pgArrayToSet(arr pq.ByteaArray) *schema.Set {
s := make([]interface{}, len(arr))
for i, v := range arr {
s[i] = string(v)
}
return schema.NewSet(schema.HashString, s)
}
Loading

0 comments on commit c8d5737

Please sign in to comment.