Update README.md

This commit is contained in:
David Allen 2025-08-20 18:10:21 -06:00 committed by GitHub
parent 050bb2a250
commit be3c308298
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -16,11 +16,11 @@ go mod tidy && go build
For now, the `artisan` only has some example code. Run it with `./artisan`. For now, the `artisan` only has some example code. Run it with `./artisan`.
## Strict Functional API ## Strict Functional Chaining API
The `artisan` tool uses an internal state-machine to create a guided experience through a strict API. Restricting the API in this manner helps to prevent small mistakes early and eliminates the need to check SQL strings at runtime. The `artisan` tool uses an internal state-machine to create a guided experience through a strict chaining API. Restricting the API in this manner helps to prevent small mistakes early while still writing code and eliminates the need to check tedious SQL strings at runtime.
By default, nothing from in the `artisan` package is exported with the exception of the `Builder` struct. The struct serves as an entry point for constructing a new SQL statement by limiting API exposure. After construction, a new collection of functions is exposed such as `Create()`, `Select()`, `Insert()` and so on. By default, nothing from in the `artisan` package is exported with the exception of the `Builder` struct. The struct serves as an entry point for constructing a new SQL statements by completely limiting API exposure. After invoking each chaining function, a new collection of functions is then exposed such as `Create()`, `Select()`, `Insert()` and so on.
For example, using the `Builder` would look something like the following example snippet below: For example, using the `Builder` would look something like the following example snippet below:
@ -45,11 +45,9 @@ sql = b.Select().From("test").Where(artisan.IsGreaterThanOrEqual("count", 10)).B
fmt.Println(sql) fmt.Println(sql)
``` ```
The beauty of this design is most noticeable when this is being typed out in VSCode in realtime. Every function call invocation prompts the editor's autocomplete feature to only show specific parts of the API are immediately available as mentioned above. The beauty of this design is most noticeable when this is being typed out in an editor like VSCode that provides a code-completion feature in realtime. Every function call invocation prompts the editor's autocomplete dropdown to only show specific parts of the API that are immediately available as a valid function call.
But what's the point? By designing the strict APIs to only be exposed in specific states, we're able to completely bypass the need for error checking (assuming that the library is built correctly). But what's the point? What's the benefit of creating or using something like this? By designing the an API like this, we're able to completely bypass the need for error checking and runtime check entirely (assuming that the library is built perfectly😃).
**Note: If there's another name for this type of design, I'd love to know!**
## Known Issues ## Known Issues