7
7
<a href =" https://sqlpkg.org/?q=stackql/split_part " >
8
8
<img src="https://img.shields.io/badge/sqlpkg-stackql/split_part-blue">
9
9
</a >
10
+ <a href =" https://sqlpkg.org/?q=stackql/aws_policy_equal " >
11
+ <img src="https://img.shields.io/badge/sqlpkg-stackql/aws_policy_equal-blue">
12
+ </a >
10
13
<a href =" https://github.com/stackql/sqlite-ext-functions/actions/workflows/build.yml " >
11
14
<img src="https://github.com/stackql/sqlite-ext-functions/actions/workflows/build.yml/badge.svg" alt="Build Status">
12
15
</a >
@@ -34,6 +37,7 @@ This repository contains a set of extended functions for SQLite designed to enha
34
37
## Features
35
38
36
39
- ** JSON Functions** : Includes ` json_equal ` to compare JSON objects and arrays.
40
+ - ** AWS Policy Functions** : Includes ` aws_policy_equal ` to compare AWS IAM policies semantically.
37
41
- ** Regular Expression Functions** : Includes ` regexp_like ` , ` regexp_substr ` , and ` regexp_replace ` for pattern matching and manipulation.
38
42
- ** String Splitting Function** : Includes ` split_part ` to split strings based on a separator and retrieve specific parts.
39
43
@@ -73,6 +77,7 @@ After compilation, you can load the extensions in your SQLite shell using:
73
77
.load ' /path/to/dist/json_equal'
74
78
.load ' /path/to/dist/regexp'
75
79
.load ' /path/to/dist/split_part'
80
+ .load ' /path/to/dist/aws_policy_equal'
76
81
```
77
82
78
83
Alternatively, you can download the extensions from [ __ sqlpkg__ ] ( https://sqlpkg.org/?q=stackql%2Fjson_equal ) .
@@ -85,7 +90,21 @@ Alternatively, you can download the extensions from [__sqlpkg__](https://sqlpkg.
85
90
SELECT json_equal(' {"key": "value"}' , ' {"key": "value"}' ); -- Returns 1 (true)
86
91
SELECT json_equal(' [1, 2, 3]' , ' [3, 2, 1]' ); -- Returns 0 (false)
87
92
```
93
+ ### AWS Policy Functions
88
94
95
+ ``` sql
96
+ -- Compare AWS policies with different element ordering
97
+ SELECT aws_policy_equal(
98
+ ' {"Version":"2012-10-17","Statement":[{"Effect":"Allow","Action":["s3:GetObject","s3:PutObject"],"Resource":"*"}]}' ,
99
+ ' {"Version":"2012-10-17","Statement":[{"Effect":"Allow","Action":["s3:PutObject","s3:GetObject"],"Resource":"*"}]}'
100
+ ); -- Returns 1 (true)
101
+
102
+ -- Compare trust policies with different Principal formats
103
+ SELECT aws_policy_equal(
104
+ ' {"Version":"2012-10-17","Statement":[{"Effect":"Allow","Principal":{"AWS":"arn:aws:iam::123456789012:role/role1"},"Action":"sts:AssumeRole"}]}' ,
105
+ ' {"Version":"2012-10-17","Statement":[{"Effect":"Allow","Principal":{"AWS":["arn:aws:iam::123456789012:role/role1"]},"Action":"sts:AssumeRole"}]}'
106
+ ); -- Returns 1 (true)
107
+ ```
89
108
### Regular Expression Functions
90
109
91
110
``` sql
@@ -119,6 +138,10 @@ Clean the distribution directory and test logs:
119
138
make clean
120
139
```
121
140
141
+ ### Publishing to ` sqlpkg `
142
+
143
+ To publish new functions to [ ` sqlpkg ` ] ( https://sqlpkg.org/ ) , raise a PR to [ nalgeon/sqlpkg] ( https://github.com/nalgeon/sqlpkg ) adding the new function manifest JSON files.
144
+
122
145
## License
123
146
124
147
This project is licensed under the MIT License - see the [ LICENSE] ( LICENSE ) file for details.
0 commit comments