2023-12-14 15:18:13 -08:00
# pg_str: the postgresql extension for strings
2023-02-19 13:32:12 -08:00
2023-12-14 15:18:13 -08:00
add some good default string manipulation functions to postgresql. build using the rust library pgrx: [https://github.com/pgcentralfoundation/pgrx ](https://github.com/pgcentralfoundation/pgrx ).
2023-02-19 13:32:12 -08:00
2023-12-14 15:18:13 -08:00
function api and behavior is inspired by the laravel web framework: [https://laravel.com/docs/10.x/strings ](https://laravel.com/docs/10.x/strings )
## installation
2023-02-19 13:32:12 -08:00
```
2023-12-14 15:18:13 -08:00
git clone https://gitea.publicmatt.com/public/pg_str.git
2023-02-19 13:32:12 -08:00
cd pg_str
cargo pgx package # run cargo install pgx first
sudo make install # adjust Makefile if using different version of postgresql than 13.
```
2023-12-14 15:18:13 -08:00
this puts the binaries and sql into the right folder location. next you need to create the extension in postgresql:
2023-02-19 13:32:12 -08:00
```
psql
2023-12-14 15:18:13 -08:00
> create extension pg_str; # installs functions in a 'public' schema.
> select str_markdown('# Hello '
2023-02-19 13:32:12 -08:00
|| str.snake('pg str')
|| '- ~~using programming language for str manipulations~~
- **do it all in postgresql** ');
```
2023-12-14 15:18:13 -08:00
## api thus far:
2023-02-19 13:32:12 -08:00
- [x] after
- [] afterLast
- [x] ascii
- [] before
- [] beforeLast
- [] between
- [x] camel
- [x] contains
- [x] containsAll
- [] endsWith
- [] finish
- [] headline
- [] is
- [x] isAscii
- [] isUuid
- [x] kebab
- [x] length
- [] limit
- [x] lower
- [x] markdown
- [] mask
- [] orderedUuid
- [] padBoth
- [] padLeft
- [] padRight
- [x] plural
- [] pluralStudly
- [x] random
- [] remove
- [x] replace
- [] replaceArray
- [] replaceFirst
- [] replaceLast
- [] reverse
- [x] singular
- [x] slug
- [x] snake
2023-12-14 15:18:13 -08:00
- [x] start
2023-02-19 13:32:12 -08:00
- [] startsWith
- [x] studly
2023-12-14 15:18:13 -08:00
- [x] substr
2023-02-19 13:32:12 -08:00
- [] substrCount
- [] substrReplace
- [x] title
- [] ucfirst
- [x] upper
- [x] uuid
- [] wordCount
- [] words