https://github.com/ajnasz/objectid-fennel
Generate mongodb object id in fennel (lua)
https://github.com/ajnasz/objectid-fennel
fennel lua mongoid objectid redis
Last synced: about 1 month ago
JSON representation
Generate mongodb object id in fennel (lua)
- Host: GitHub
- URL: https://github.com/ajnasz/objectid-fennel
- Owner: Ajnasz
- License: mit
- Created: 2021-09-05T15:09:23.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2022-07-20T09:34:01.000Z (almost 4 years ago)
- Last Synced: 2025-07-11T11:52:34.004Z (11 months ago)
- Topics: fennel, lua, mongoid, objectid, redis
- Language: Fennel
- Homepage:
- Size: 18.6 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ObjectID generator in fennel
The project is to experiment with the fennel language ([https://fennel-lang.org/](https://fennel-lang.org/))
## Run
```sh
fennel main.fnl
```
To generate 10 objectids
```sh
fennel main.fnl 10
```
## Compile to lua
```sh
fennel --compile --require-as-include main.fnl > main.lua
```
```sh
lua main.lua
```
To generate 10 objectids
```sh
lua main.lua 10
```
### Use as a library
```sh
fennel --compile --require-as-include objectid.fnl > objectid.lua
```
```lua
oid = require'objectid'
print(oid.generate())
```
## ObjectID redis
```sh
$ fennel --compile objectid-redis.fnl > objectid-redis.lua
$ redis-cli --eval objectid-redis.lua 2
1) "62c9cba68935721da3887375"
2) "62c9cba68935721da3887376"
```