Tag: golang
14 รายการ
Blog
Beyond Syntax: เขียน Go ให้ Scale กับทีม ไม่ใช่แค่ CPU
รวม 12 แนวคิดที่แยก Go ระดับ "เขียนได้" ออกจาก Go ระดับ "คิดมาแล้ว" — ตั้งแต่ function signature, error handling, interface design, concurrency ownership ไปจนถึง package structure, naming convention, dependency injection และ graceful shutdown ที่ทำให้โค้ดอ่านง่ายขึ้นจริงในระดับทีม
7 Concurrency Patterns ใน Go ที่คุณต้องรู้ — อัปเดต Go 1.25/1.26
รวม 7 รูปแบบ concurrency ที่สำคัญที่สุดใน Go พร้อมตัวอย่างโค้ดที่อัปเดตสำหรับ Go 1.25/1.26 ครอบคลุม Worker Pool, Fan-Out/Fan-In, Pipeline, Pub-Sub, Select Timeout, Semaphore และ Rate Limiting
25 เทคนิค Go ที่นักพัฒนามืออาชีพใช้จริงในงาน Production
รวม 25 เทคนิค Go (Golang) ที่ใช้ได้จริงตั้งแต่ goroutines, channels, context, error handling ไปจนถึง generics, structured logging และฟีเจอร์ใหม่ใน Go 1.25/1.26 พร้อมตัวอย่างโค้ดและ diagram ประกอบทุกหัวข้อ
คู่มือติดตั้ง Go (Golang) ฉบับเข้าใจง่าย
เรียนรู้วิธีติดตั้ง Go (Golang) บน Windows, macOS และ Linux แบบ step-by-step พร้อมตัวอย่างโค้ดและเคล็ดลับสำหรับมือใหม่
IoT Workshop #4: วาง Foundation ด้วย Go + Fiber
เริ่มต้น backend ของ IoT Platform แบบ runnable จริง — Go 1.24 + Fiber v2 อ่าน config จาก env ด้วย Viper, zap structured logger, middleware ครบชุด, health check และ graceful shutdown พร้อม distroless Docker image
IoT Workshop #5: MongoDB Models & Repository Pattern
ออกแบบ domain model สำหรับ IoT Platform ด้วย Go + MongoDB driver v2 — BSON tags, connection pooling, indexes แบบ idempotent, validator ที่ใช้ json tag, และ Repository Pattern ที่กัน NoSQL injection ด้วย typed filter
IoT Workshop #6: Device Management API ด้วย Go Fiber
ประกอบ repository เป็น REST API จัดการ IoT device — service layer ที่ออก ingestion token, handler บางๆ ที่ map error เป็น HTTP status, envelope httpx (data/error/pagination), bulk create และ unit test แบบ table-driven ที่ mock repository
รับ Sensor Data เข้า InfluxDB แบบไม่กลัวตาย
พาสร้าง Sensor Ingestion ด้วย Go + Fiber ตั้งแต่ REST รับ single/batch, validate ด้วย validator/v10, เช็ค device จาก registry, เขียนลง InfluxDB 2.x แบบ blocking ที่ error เด้งกลับ HTTP จริง พร้อม rate limit แบบ token-bucket ต่อ device
MQTT: ให้ Device คุยกับ Server แบบเบาๆ
เชื่อม backend กับ Mosquitto ด้วย Eclipse Paho Go client v1.5.1 — subscribe topic devices/+/telemetry, publish command ไป devices/{id}/command, auto-reconnect + re-subscribe, แล้วป้อน telemetry เข้า ingestion path เดียวกับ REST API
WebSocket Real-time: ดูข้อมูล IoT แบบสดๆ
สร้าง real-time layer ด้วย gofiber/contrib/websocket — Hub แบบ single-goroutine ที่เป็นเจ้าของ state ทั้งหมด, room system (device:/group:), fan-out telemetry จาก ingestion path, heartbeat ping/pong และ back-pressure ที่ตัด client ช้าทิ้ง
Go Alerting Engine: ให้ระบบ IoT แจ้งเตือนเองเลย
สร้าง alerting engine เป็น Go ตั้งแต่ rule แบบ threshold / offline / anomaly (z-score), การประเมินบน ingestion path, cooldown, alert history บน Mongo (TTL) จนถึง webhook แบบ Slack-compatible พร้อม SSRF guard และ REST CRUD ที่ /api/v1/alert-rules
ทำระบบ Auth + RBAC ให้ IoT Platform
ทำ Authentication แบบ production จริงด้วย Go (Fiber) + React: JWT access+refresh, argon2id, RBAC admin/operator/viewer, rate-limited /auth, refresh rotation + reuse detection + tokenVersion และ silent refresh ฝั่ง client
Master Plan: สร้าง IoT Platform ครบวงจร 18 step + E2E
แผนโรดแมปสร้าง IoT Platform ตั้งแต่ศูนย์ — Go + Fiber, MongoDB 8, Mosquitto, InfluxDB 2.7 + Flux, Telegraf, LynxJS Mobile และ Vite+React Admin (JWT/RBAC) รวม 18 step + E2E ใน monorepo เดียว
IoT Workshop #1: ออกแบบ Architecture ก่อนลงมือจริง
พี่โชว์พา Design System Architecture แบบ event-driven สำหรับ IoT Platform จริง ตั้งแต่ Data Flow (ingest/command/query), Communication Patterns (REST/MQTT/WebSocket) ไปจนถึงเหตุผลที่เลือก Tech Stack แต่ละตัว