github.com/sttk/sabi@v0.5.0/README.md (about) 1 # [Sabi][repo-url] [![Go Reference][pkg-dev-img]][pkg-dev-url] [![CI Status][ci-img]][ci-url] [![MIT License][mit-img]][mit-url] 2 3 A small framework to separate logics and data accesses for Golang application. 4 5 ## Concept 6 7 Sabi is a small framework for Golang applications. 8 This framework separates an application to logic parts and data access parts, and enables to implement each of them independently, then to combine them. 9 10 ### Separation of logics and data accesses 11 12 In general, a program consists of procedures and data. 13 And procedures include data accesses for operating data, and the rest of procedures are logics. 14 So we can say that a program consists of logics, data accesses and data. 15 16 Furthermore, we often think to separate an application to multiple layers, for example, controller layer, application logic layer, and data access layer. 17 The logic and data access mentioned in this framework are partially matched those layers, but are not matched in another part. 18 For example, in the controller layer, there are input data and output data. (In a web application there are request data and response data, and in a command line application there are console input and output.) 19 Even though all logical processes are moved into the application logic layer, it is remained to transform input data of the controller layer into input data of the application logic layer, and to transform output data of the application logic layer into the output data of the controller layer. 20 The data accesses mentioned in this framework also includes those data accesses. 21 22 ### Changes composition of data access methods by concerns 23 24 Dax is a collection of data access methods. These methods will be collected/divided by data source from an implementation perspective. On the other hand, they will be collected/divided by logic from a usage perspective 25 26 In general programming, a developer chooses the necessary methods for their logic from among all available methods. And after programming, those methods will be buried in the program code of the logic, and it will become unclear which methods are used without tracing the logic. 27 28 In applications using the Sabi framework, a logic is implemented as a function that takes only one argument, a dax interface. And this interface can define only the methods required by the logic. 29 Therefore, a dax interface can make clear which methods are used in a logic. And also, a dax interface can constraint methods available for a logic. 30 31 32 ## Usage 33 34 The usage of this framework is described on the overview in the go package document. 35 36 See https://pkg.go.dev/github.com/sttk/sabi#pkg-overview. 37 38 39 ## Supporting Go versions 40 41 This framework supports Go 1.18 or later. 42 43 ### Actual test results for each Go version: 44 45 ``` 46 % gvm-fav 47 Now using version go1.18.10 48 go version go1.18.10 darwin/amd64 49 ok github.com/sttk/sabi 0.834s coverage: 99.6% of statements 50 51 Now using version go1.19.5 52 go version go1.19.5 darwin/amd64 53 ok github.com/sttk/sabi 0.836s coverage: 99.6% of statements 54 55 Now using version go1.20 56 go version go1.20 darwin/amd64 57 ok github.com/sttk/sabi 0.843s coverage: 99.6% of statements 58 59 Back to go1.20 60 Now using version go1.20 61 % 62 ``` 63 64 65 ## License 66 67 Copyright (C) 2022-2023 Takayuki Sato 68 69 This program is free software under MIT License.<br> 70 See the file LICENSE in this distribution for more details. 71 72 73 [repo-url]: https://github.com/sttk/sabi-go 74 [pkg-dev-img]: https://pkg.go.dev/badge/github.com/sttk/sabi.svg 75 [pkg-dev-url]: https://pkg.go.dev/github.com/sttk/sabi 76 [ci-img]: https://github.com/sttk/sabi-go/actions/workflows/go.yml/badge.svg?branch=main 77 [ci-url]: https://github.com/sttk/sabi-go/actions 78 [mit-img]: https://img.shields.io/badge/license-MIT-green.svg 79 [mit-url]: https://opensource.org/licenses/MIT