Browse Source

clean up messy initial comit, remove last traces of working project name, and add resilience to db test.

master
Gisle Aune 5 years ago
parent
commit
6837e7b4c8
  1. 2
      .gitignore
  2. 8
      .idea/.gitignore
  3. 5
      .idea/codeStyles/codeStyleConfig.xml
  4. 11
      .idea/dataSources.xml
  5. 13
      .idea/dictionaries/gisle.xml
  6. 6
      .idea/misc.xml
  7. 8
      .idea/modules.xml
  8. 7
      .idea/sqldialects.xml
  9. 29
      .idea/watcherTasks.xml
  10. 8
      .idea/xiaoli.iml
  11. 24
      database/drivers/mysqldriver/db_test.go
  12. 4983
      graph/graphcore/exec_gen.go
  13. 38
      graph/graphcore/input_gen.go
  14. 4
      main.go

2
.gitignore

@ -0,0 +1,2 @@
/.idea
/graph/graphcore/*

8
.idea/.gitignore

@ -1,8 +0,0 @@
# Default ignored files
/shelf/
/workspace.xml
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml
# Editor-based HTTP Client requests
/httpRequests/

5
.idea/codeStyles/codeStyleConfig.xml

@ -1,5 +0,0 @@
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
</state>
</component>

11
.idea/dataSources.xml

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DataSourceManagerImpl" format="xml" multifile-model="true">
<data-source source="LOCAL" name="xiaoli@localhost" uuid="58ed4679-da13-4e36-bc48-70b2cb7bb1fe">
<driver-ref>mariadb</driver-ref>
<synchronize>true</synchronize>
<jdbc-driver>org.mariadb.jdbc.Driver</jdbc-driver>
<jdbc-url>jdbc:mariadb://localhost:3306/xiaoli</jdbc-url>
</data-source>
</component>
</project>

13
.idea/dictionaries/gisle.xml

@ -1,13 +0,0 @@
<component name="ProjectDictionaryState">
<dictionary name="gisle">
<words>
<w>blargh</w>
<w>blendings</w>
<w>graphcore</w>
<w>qpos</w>
<w>sourcream</w>
<w>stufflog</w>
<w>xiaoli</w>
</words>
</dictionary>
</component>

6
.idea/misc.xml

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="JavaScriptSettings">
<option name="languageLevel" value="ES6" />
</component>
</project>

8
.idea/modules.xml

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/xiaoli.iml" filepath="$PROJECT_DIR$/.idea/xiaoli.iml" />
</modules>
</component>
</project>

7
.idea/sqldialects.xml

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="SqlDialectMappings">
<file url="file://$PROJECT_DIR$/migrations/mysql/20200405173553_create_table_project.sql" dialect="GenericSQL" />
<file url="PROJECT" dialect="MariaDB" />
</component>
</project>

29
.idea/watcherTasks.xml

@ -1,29 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectTasksOptions">
<TaskOptions isEnabled="true">
<option name="arguments" value="fmt $FilePath$" />
<option name="checkSyntaxErrors" value="true" />
<option name="description" />
<option name="exitCodeBehavior" value="ERROR" />
<option name="fileExtension" value="go" />
<option name="immediateSync" value="false" />
<option name="name" value="go fmt" />
<option name="output" value="$FilePath$" />
<option name="outputFilters">
<array />
</option>
<option name="outputFromStdout" value="false" />
<option name="program" value="$GoExecPath$" />
<option name="runOnExternalChanges" value="false" />
<option name="scopeName" value="Project Files" />
<option name="trackOnlyRoot" value="true" />
<option name="workingDir" value="$ProjectFileDir$" />
<envs>
<env name="GOROOT" value="$GOROOT$" />
<env name="GOPATH" value="$GOPATH$" />
<env name="PATH" value="$GoBinDirs$" />
</envs>
</TaskOptions>
</component>
</project>

8
.idea/xiaoli.iml

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

24
database/drivers/mysqldriver/db_test.go

@ -13,17 +13,26 @@ var testDB *DB
func TestMain(m *testing.M) { func TestMain(m *testing.M) {
testDbConnect := os.Getenv("DB_TEST_CONNECT") testDbConnect := os.Getenv("DB_TEST_CONNECT")
if testDbConnect == "" { if testDbConnect == "" {
testDbConnect = "xiaoli_test:test1234@(localhost:3306)/xiaoli_test"
testDbConnect = "stufflog_test:test1234@(localhost:3306)/stufflog_test"
} }
db, err := Open(testDbConnect)
if err != nil {
log.Println("DB ERROR", err)
for i := 0; i < 10; i++ {
db, err := Open(testDbConnect)
if err != nil {
log.Println("DB ERROR", err)
time.Sleep(time.Second)
continue
}
testDB = db
}
if testDB == nil {
log.Println("DB FAILED")
os.Exit(1) os.Exit(1)
return return
} }
err = goose.SetDialect("mysql")
err := goose.SetDialect("mysql")
if err != nil { if err != nil {
log.Println("GOOSE ERROR", err) log.Println("GOOSE ERROR", err)
os.Exit(1) os.Exit(1)
@ -31,20 +40,19 @@ func TestMain(m *testing.M) {
} }
for { for {
err = goose.Down(db.db.DB, "../../../migrations/mysql")
err = goose.Down(testDB.db.DB, "../../../migrations/mysql")
if err != nil { if err != nil {
break break
} }
} }
err = goose.Up(db.db.DB, "../../../migrations/mysql")
err = goose.Up(testDB.db.DB, "../../../migrations/mysql")
if err != nil && err != goose.ErrNoNextVersion && err != goose.ErrNoCurrentVersion { if err != nil && err != goose.ErrNoNextVersion && err != goose.ErrNoCurrentVersion {
log.Println("UP ERROR", err) log.Println("UP ERROR", err)
os.Exit(3) os.Exit(3)
return return
} }
testDB = db
code := m.Run() code := m.Run()
os.Exit(code) os.Exit(code)

4983
graph/graphcore/exec_gen.go
File diff suppressed because it is too large
View File

38
graph/graphcore/input_gen.go

@ -1,38 +0,0 @@
// Code generated by github.com/99designs/gqlgen, DO NOT EDIT.
package graphcore
import (
"git.aiterp.net/stufflog/server/models"
)
// A limited filter for constraining the list of issues within a project.
type ProjectIssueFilter struct {
// Filter by assignee IDs
AssigneeIds []string `json:"assigneeIds"`
// Text search
Search *string `json:"search"`
// Earliest stage (inclusive)
MinStage *int `json:"minStage"`
// Latest stage (inclusive)
MaxStage *int `json:"maxStage"`
// Limit the result set
Limit *int `json:"limit"`
}
// The permissions of a user within the project.
type ProjectPermissions struct {
// User ID.
UserID string `json:"userId"`
// Access level.
AccessLevel int `json:"accessLevel"`
// The user whose permissions it is. Can be null if the user no longer exists.
User *models.User `json:"user"`
}
// Input for loginUser.
type UserLoginInput struct {
UserID string `json:"userId"`
Password string `json:"password"`
RememberMe bool `json:"rememberMe"`
}

4
main.go

@ -12,7 +12,7 @@ import (
func main() { func main() {
app := &cli.App{ app := &cli.App{
Name: "xiaoli",
Name: "stufflog",
Usage: "Issue tracker for your home and hobbies", Usage: "Issue tracker for your home and hobbies",
Flags: []cli.Flag{ Flags: []cli.Flag{
&cli.StringFlag{ &cli.StringFlag{
@ -23,7 +23,7 @@ func main() {
}, },
&cli.StringFlag{ &cli.StringFlag{
Name: "db-connect", Name: "db-connect",
Value: "xiaoli_user:stuff1234@(localhost:3306)/xiaoli",
Value: "stufflog_user:stuff1234@(localhost:3306)/stufflog",
Usage: "Database connection string or path", Usage: "Database connection string or path",
EnvVars: []string{"DATABASE_CONNECT"}, EnvVars: []string{"DATABASE_CONNECT"},
}, },

Loading…
Cancel
Save