MRMuhammad Redho Ayassainredhoyasa.hashnode.dev·Sep 18, 2023 · 1 min readOn JSON.stringify()Background When working with a Node.js service, I intended to send a request to another service with JSON: { "name": "Instant noddle", "category": null } However, I didn't manage to send the category field and this is what I sent instead: { ...00
MRMuhammad Redho Ayassainredhoyasa.hashnode.dev·Sep 18, 2023 · 1 min readTriggering form submission outside the <form>Context Suppose I want to build a checkout page like below: The first box (above) contains the guest form The second box (below) is a bottom sheet containing the hotel rate and the form submission button To make the bottom sheet sticky at the bo...00
MRMuhammad Redho Ayassainredhoyasa.hashnode.dev·Jul 11, 2023 · 1 min readLogging inside Java StreamBackground Once upon a time, I wanted to log something that was executed inside the Java stream for debugging purposes. But, I didn't see anything logged there. Solution Put the log inside the peek() method instead of map(). Example Previously, I was...00
MRMuhammad Redho Ayassainredhoyasa.hashnode.dev·Jan 10, 2023 · 1 min readUpdating database field to NULL in GORM using structBackground When I was using GORM as the ORM in Go, I discovered that we cannot update a field into NULL with struct, even though we use a pointer as the type. For example, if we set nil to the Name and execute the Updates method in GORM, the name fie...00
MRMuhammad Redho Ayassainredhoyasa.hashnode.dev·Dec 14, 2022 · 1 min readWorking with Postgres JSONB in GoBackground Suppose I want to store and read a JSONB/JSON column from Postgres, how do I do it? Solution Make the data type implements these functions: Scan(src any) error -> Move data from DB to Go struct Value() -> Return the JSON encoding that sto...00