2个版本

0.2.1 2022年1月31日
0.2.0 2022年1月31日

1457 in 数据库接口

MIT 许可证

8KB
122

Postgresql 字符串扩展

在Postgresql中处理字符串操作和转换的更好方法。

函数API和行为灵感来源于Laravel网络框架中的功能:https://laravel.net.cn/docs/8.x/helpers#strings-method-list

安装

git clone [email protected]:abumni/pg_str
cd pg_str
cargo pgx package # run cargo install pgx first
sudo make install # adjust Makefile if using different version of postgresql than 13.

这会将二进制文件和sql文件放入正确的文件夹位置。接下来您需要在postgresql中创建扩展

psql
> create extension pg_str; # installs functions in a schema named 'str'
> select str.markdown('# Hello '
|| str.snake('pg str')
|| '- ~~using programming language for str manipulations~~ 
- **do it all in postgresql** ');

API

  • [] after
  • [] afterLast
  • [] ascii
  • [] before
  • [] beforeLast
  • [] between
  • camel
  • contains
  • containsAll
  • [] endsWith
  • [] finish
  • [] headline
  • [] is
  • isAscii
  • [] isUuid
  • kebab
  • [] length
  • [] limit
  • lower
  • markdown
  • [] mask
  • [] orderedUuid
  • [] padBoth
  • [] padLeft
  • [] padRight
  • plural
  • [] pluralStudly
  • [] random
  • [] remove
  • replace
  • [] replaceArray
  • [] replaceFirst
  • [] replaceLast
  • [] reverse
  • singular
  • slug
  • snake
  • [] start
  • [] startsWith
  • studly
  • [] substr
  • [] substrCount
  • [] substrReplace
  • title
  • [] toHtmlString
  • [] ucfirst
  • upper
  • [] uuid
  • [] wordCount
  • [] words

依赖项

~21–36MB
~698K SLoC