|
|
4 tuần trước cách đây | |
|---|---|---|
| configs | 4 tuần trước cách đây | |
| docs | 4 tuần trước cách đây | |
| parseResults | 4 tuần trước cách đây | |
| README.md | 4 tuần trước cách đây |
Repository ini berisi contoh-contoh penggunaan fungsi ACE_LIB.getConfig() untuk parsing YAML nested dengan berbagai skenario.
Fungsi getConfig() adalah YAML parser yang dapat membaca file konfigurasi dengan struktur nested (object dan array) dan mengembalikan JSON yang dapat langsung diakses di ESQL.
Repository ini menyediakan 5 skenario testing yang mencakup berbagai use case:
| Config | Scenario | Description |
|---|---|---|
| CONFIG1.yaml | Standard Nested YAML | Multiple root keys dengan nested objects dan arrays |
| CONFIG2.yaml | Flat YAML | Structure flat tanpa root key, diakses dengan wildcard '*' |
| CONFIG3.yaml | Corner Case: Empty Values | Testing empty values, mixed arrays, dan special characters |
| CONFIG4.yaml | Corner Case: Deep Nesting | Deep nesting (5+ levels) dan complex nested structures |
| CONFIG5.yaml | Simple Key-Value | Practical real-world config dengan arrays dan nested objects |
ACE_LIB.getConfig-moreExample/
├── README.md # File ini
├── configs/ # 5 File YAML untuk testing
│ ├── CONFIG1.yaml
│ ├── CONFIG2.yaml
│ ├── CONFIG3.yaml
│ ├── CONFIG4.yaml
│ └── CONFIG5.yaml
├── parseResults/ # Hasil JSON dari parsing
│ ├── hasilParseConfig1.json
│ ├── hasilParseConfig2.json
│ ├── hasilParseConfig3.json
│ ├── hasilParseConfig4.json
│ └── hasilParseConfig5.json
└── docs/ # Detailed documentation
├── config1-scenario.md
├── config2-scenario.md
├── config3-scenario.md
├── config4-scenario.md
└── config5-scenario.md
Untuk penjelasan lengkap setiap skenario, lihat dokumentasi berikut:
-- Example: Load CONFIG1 dengan key 'fundtastic'
DECLARE config REFERENCE TO Environment.Variables;
DECLARE success BOOLEAN;
CALL ACE_LIB.getConfig(
'TEST_CONFIG1', -- Cache ID
'fundtastic', -- Key yang akan diambil
'/path/to/CONFIG1.yaml', -- Path ke file
'600', -- Cache expiry (seconds)
config -- OUT: Reference hasil parse
) INTO success;
IF success THEN
-- Akses data
DECLARE apiSecret CHARACTER config.ApiSecret;
DECLARE endpoint CHARACTER config.endpoint;
END IF;
| Feature | Config 1 | Config 2 | Config 3 | Config 4 | Config 5 |
|---|---|---|---|---|---|
| Nested Objects | ✅ | ✅ | ✅ | ✅ | ✅ |
| Arrays of Strings | ✅ | ✅ | - | ✅ | ✅ |
| Arrays of Objects | ✅ | ✅ | ✅ | ✅ | ✅ |
| Multiple Root Keys | ✅ | - | - | - | ✅ |
| Flat YAML (wildcard) | - | ✅ | - | - | - |
| Empty Values | - | - | ✅ | - | - |
| Mixed Arrays | - | - | ✅ | - | - |
| Deep Nesting (5+ levels) | - | - | - | ✅ | - |
| Special Characters | - | - | ✅ | - | - |
key:) di-parse menjadi empty string ""