This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ╔══════════╦═══════════════════╦══════════════════════════════════════════════════════════════════════════╦════════════════════════╦════════════════════════════════════╦════════════════════════╗ | |
| ║ Operator ║ Tipe Data Operand ║ Deskripsi ║ Contoh Data ║ Contoh penggunaan Operator ║ Hasil ║ | |
| ╠══════════╬═══════════════════╬══════════════════════════════════════════════════════════════════════════╬════════════════════════╬════════════════════════════════════╬════════════════════════╣ | |
| ║ @> ║ jsonb ║ Apakah nilai x ada di data JSON? ║ {"a":1, "b":2}' ║ ::jsonb @> '{"b":2}'::jsonb ║ {"a":1, "b":2}' ║ | |
| ║ <@ ║ jsonb ║ Apakah nilai data JSON mengandung nilai x ? ║ {"b":2}' ║ ::jsonb <@ '{"a":1, "b":2}'::jsonb ║ {"b":2}' ║ | |
| ║ ? ║ text ║ Apakah key terat |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ╔══════════╦═══════════════════╦═══════════════════════════════════════════════════════════════════════════╦══════════════════════════════════════╦════════════════════════════╦═════════════════╗ | |
| ║ Operator ║ Tipe Data Operand ║ Deskripsi ║ Contoh Data ║ Contoh penggunaan Operator ║ Hasil ║ | |
| ╠══════════╬═══════════════════╬═══════════════════════════════════════════════════════════════════════════╬══════════════════════════════════════╬════════════════════════════╬═════════════════╣ | |
| ║ -> ║ int ║ Mendapatkan data dengan index spesifik ║ [1,2,3] ║ -> 0 ║ 1 ║ | |
| ║ -> ║ text ║ Mendapatkan data berdasarkan key ║ {"a":"foo"},{"b":"bar"},{"c":"baz"}' ║ -> 'a' ║ {"a":"foo"} ║ | |
| ║ ->> ║ int ║ Mendapatkan data |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| apt update | |
| apt install apt-transport-https ca-certificates curl gnupg2 software-properties-common -y | |
| curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add - | |
| add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable" | |
| apt update | |
| apt install docker-ce -y |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class TollGate | |
| def initialize(card) | |
| @status = 0 | |
| end | |
| def open_gate | |
| @status = 1 | |
| end | |
| def close_gate |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class TollGate | |
| def initialize(card, balance) | |
| @status = 0 | |
| @card = card | |
| @balance = balance | |
| end | |
| def read_card | |
| true if @card == 'toll-card' | |
| false |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| #include <string.h> | |
| #include <stdlib.h> | |
| using namespace std; | |
| struct exam { | |
| char examName[40]; | |
| char examCode[5]; | |
| int date; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package consumer | |
| import ( | |
| "os" | |
| "github.com/Shopify/sarama" | |
| "github.com/sirupsen/logrus" | |
| ) | |
| // KafkaConsumer hold sarama consumer |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package consumer_test | |
| import ( | |
| "os" | |
| "testing" | |
| "time" | |
| "github.com/Shopify/sarama" | |
| "github.com/Shopify/sarama/mocks" | |
| "github.com/mufti1/kafka-example/consumer" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "fmt" | |
| "time" | |
| "github.com/Shopify/sarama" | |
| "github.com/mufti1/kafka-example/producer" | |
| "github.com/sirupsen/logrus" | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package producer | |
| import ( | |
| "github.com/Shopify/sarama" | |
| "github.com/sirupsen/logrus" | |
| ) | |
| // KafkaProducer hold kafka producer session | |
| type KafkaProducer struct { | |
| Producer sarama.SyncProducer |
NewerOlder