Introducing genapi: A Golang HTTP Client Code Generator

In this article, I’m excited to introduce genapi, a code generator for Golang HTTP clients. For comprehensive documentation and implementation details, you can explore the genapi website or check out our GitHub repository. From Manual to Automatic: Evolution of Golang HTTP Client In Golang development, making HTTP API calls is a very common requirement. Through a weather API example, this article will demonstrate how HTTP client code evolves from manual writing to automatic generation. Let’s look at this simple weather API: ...

March 3, 2025 · 4 mins · Lex Cao

Learn Rust by Building a Full-stack Todo Application

What I want to write a blog about how I learned Rust. Please forgive me that I just started learning such a great programming language in 2022. To learn Rust by doing, I have built a full-stack todo application. You can try it here. The source code is available at GitHub. Here I am going to write about how to build it. How Firstly, as everyone beginning, I learn Rust from the book as well. It is an awesome book to start learning Rust, and you should not skip it. ...

May 1, 2022 · 3 mins · Lex Cao

Kotlin Weird Equality

Recently, I encountered a weird equality question about Kotlin which does not usually get much attention while coding. So here is the thought process. Background The following code snippet is using Kotlin 1.3.72. The business logic of it has been removed and only remained the code structure for reproducing the question. // a enum for state enum class MyState { OK, CANCELED } // it might return nullable MyState fun processing(): MyState? { // asuming that it returns the CANCELED state return MyState.CANCELED } // when processing the state fun handleState() { // the type of state is MyState? val state = processing() if (state == CANCELED) { // if condition counld not reach here println("Handle <CANCELED> state") } } The reason why it could not reach the CANCELED condition is the import. ...

April 21, 2020 · 8 mins · Lex Cao

Generate Converter for Kotlin Class by KAPT

Background In web backend development, the operation of an entity need to code a number of similar classes to handle request (avoiding the direct use of entities), which resulting in related terminology: PO (Persistent Object) DTO (Data Transfer Object) BO (Business Object) VO (View Object) Most of these classes trim a few fields directly from the entity. For example, by using OrderEntity in a request to create an order, it would process like following: ...

April 13, 2020 · 4 mins · Lex Cao

Reactive Overview

Reactive Streams Reactive Streams started as an initiative in late 2013 between engineers at Netflix, Pivotal and Lightbend. Reactive Streams is an initiative to provide a standard for asynchronous stream processing with non-blocking back pressure. This encompasses efforts aimed at runtime environments (JVM and JavaScript) as well as network protocols. You can read the origin specification on official website of Reactive Streams. Also, you can read the Chinese translation from here. Asynchronous stream processing with non-blocking back pressure. The Reactive Streams is composed of following: ...

November 28, 2019 · 3 mins · Lex Cao