/mysql-ulid-plugin

MySQL UDF Plugin for generating ULIDs

Primary LanguageC++MIT LicenseMIT

mysql-ulid-plugin

MySQL UDF Plugin for generating ULIDs

How to build

Install mysql_config

For Ubuntu.

$ sudo apt install libmysqlclient-dev

For macOS with homebrew

$ brew install mysql-connector-c

Build

$ mkdir build && cd $_
$ cmake ../
$ make

Run test

$ mysql build && cd $_
$ cmake ../
$ make test

or

$ mysql build && cd $_
$ cmake ../
$ ./ulid-gtest

Use ULID()

CREATE FUNCTION ulid RETURNS STRING SONAME 'ulid.so';
SELECT ULID();

Warning: If mysql client run with --binary-as-hex=1, Return string is represent as hex.