Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/massivefermion/blah
fake data generation for gleam
https://github.com/massivefermion/blah
Last synced: 3 months ago
JSON representation
fake data generation for gleam
- Host: GitHub
- URL: https://github.com/massivefermion/blah
- Owner: massivefermion
- License: apache-2.0
- Created: 2022-10-02T10:18:43.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-05-22T07:45:26.000Z (6 months ago)
- Last Synced: 2024-05-22T08:43:00.482Z (6 months ago)
- Language: Gleam
- Homepage: https://hex.pm/packages/blah
- Size: 2.32 MB
- Stars: 11
- Watchers: 2
- Forks: 3
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-gleam - blah - [📚](https://hexdocs.pm/blah/) - fake data generation for gleam (Packages / Randomness)
README
![blah](https://raw.githubusercontent.com/massivefermion/blah/main/banner.png)
[![Package Version](https://img.shields.io/hexpm/v/blah)](https://hex.pm/packages/blah)
[![Hex Docs](https://img.shields.io/badge/hex-docs-ffaff3)](https://hexdocs.pm/blah/)# blah
fake data generation for gleam
## 🎲 Installation
```sh
gleam add blah
```## 🎲 Usage
```gleam
import blah/name
import blah/time
import blah/other
import blah/internet
import birl
import birl/duration
import bison/object_idpub type Person {
Person(
id: object_id.ObjectId,
name: String,
username: String,
birthday: birl.Time,
age: Int,
)
}pub fn generate_fake_person() {
let assert Ok(id) = object_id.from_string(other.mongo_object_id())
let name = name.first_name()
let birthday = time.past(duration.years(18), duration.years(32))
let assert #(age, duration.Year) =
duration.blur(birl.difference(birl.now(), birthday))Person(
id: id,
name: name,
username: internet.username(name),
birthday: birthday,
age: age,
)
}
```