The highest tagged major version is
v4.
package
Version:
v2.1.0
Opens a new window with list of versions in this module.
Published: Sep 14, 2022
License: MIT
Opens a new window with license information.
Imports: 3
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
README
¶
- Repository is a place where you communicate with the real external data source, like database, cloud service, external service, etc.
- You should keep your repository as simple as possible, don't add too much logic here
- If you have to, you can separate the operations into smaller methods, then do the flow in the service package
- You should always call your repository methods inside the service package
- You may use your
src/library
functions directly in this package
- Any changes outside this package should not affect your repositories (except changes for business entity)
- If you need config variables, database frameworks, or external clients, pass/inject them as dependency
- You can use your own style as long as it doesn't break the main idea
Documentation
¶
NewExampleMySQL generates new exampleMySQL that implements Example.
type ExampleFindAllResult struct {
Examples []*entity.Example `json:"examples"`
Error error `json:"error"`
}
type NewExampleMySQLParam struct {
DB *sql.DB
}
type NewParam struct {
MySQLDB *sql.DB
}
type Repository struct {
Example Example
}
New generates new repository.
Source Files
¶
Directories
¶
Click to show internal directories.
Click to hide internal directories.