Conversation
Proji now uses gorm to power its main storage. Gorm simplifies proji's code base vastly and allows usage of mysql, mssql, postgres and sqlite databases as backend storage. Updates to the main config will follow soon. Notice that the models which represent tables in the database also changed and are not backwards compatible and definitly breaking.
Removed most of the tests after refactoring the storage package and will do pretty much all tests of the repo in the very near future.
The makefile was adapted from https://github.com/goreleaser/goreleaser/blob/master/Makefile and allows you to setup the environment, build, format, lint and test the project and list todo items from the code.
UnsupportedDatabaseDialectError decribes an error in the case that a driver to a unsupported database dialect got passed. See https://gorm.io/docs/connecting_to_the_database.html#Supported-Databases for a list of supported drivers.
In case of an unsupported database driver, the function will now return a UnsupportedDatabaseDialectError. Previously the default case just set the dialector to nil and returned an empty error.
The const TokenKeys in the code don't actually hold the token but the config key under which the token may be found and included.
The main config now allows the specification of a custom database. You can set the database.driver and database.dsn fields. Check the docs for more informations. Defaults to 'sqlite3' as a driver and 'db/proji.sqlite3' as a dsn.
Renamed the env field 'Svc' to 'StorageService'.
Changing back to the old working directory was executed by defer and its error was thus ignored. defer is now wrapped in an anonymous function where a potential error will be handled.
Cobra and Viper make you use global variables and init functions. So we have to ignore the two linters in the cmd package.
Remove pkg directory and move its content to the root of the project.
Add an optional description with a maximum length of 255 characters.
Even though its not really useful; the name is used to create a project so it should probably be stored too.
Replace the functions LoadAllClasses and LoadAllProjects with LoadClasses and LoadProjects. The new functions take a spread string array as parameter. If one or multiple inputs are given, the function returns one or multiple classes/projects. If no input is given all classes/projects will be returned.
Codecov Report
@@ Coverage Diff @@
## master #128 +/- ##
===========================================
- Coverage 55.99% 17.05% -38.95%
===========================================
Files 8 35 +27
Lines 959 1466 +507
===========================================
- Hits 537 250 -287
- Misses 333 1200 +867
+ Partials 89 16 -73
Continue to review full report at Codecov.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Improve the storage services. Simpler structure, easier to use and support for more databases.
Proposed Changes