Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
tank
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
AURA
tank
Commits
9dbb76f2
Commit
9dbb76f2
authored
6 years ago
by
Christian Pointner
Browse files
Options
Downloads
Patches
Plain Diff
added import state to file model
parent
5bae0210
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
store/store_test.go
+9
-9
9 additions, 9 deletions
store/store_test.go
store/types.go
+51
-51
51 additions, 51 deletions
store/types.go
with
60 additions
and
60 deletions
store/store_test.go
+
9
−
9
View file @
9dbb76f2
...
...
@@ -33,15 +33,15 @@ import (
)
var
(
testBasePath
=
"run/aura-tank_testing"
testDBType
=
"mysql"
testDBConnection
=
"tank:aura@tcp(127.0.0.1:3306)/tank?charset=utf8&parseTime=True&loc=Local"
//
testDBType = "postgres"
//
testDBConnection = "host=127.0.0.1 port=5432 user=tank dbname=tank password=aura sslmode=disable"
testGroup1
=
"test1"
testGroup2
=
"test2"
testUser1
=
"user1"
testUser2
=
"user2"
testBasePath
=
"run/aura-tank_testing"
//
testDBType = "mysql"
//
testDBConnection = "tank:aura@tcp(127.0.0.1:3306)/tank?charset=utf8&parseTime=True&loc=Local"
testDBType
=
"postgres"
testDBConnection
=
"host=127.0.0.1 port=5432 user=tank dbname=tank password=aura sslmode=disable"
testGroup1
=
"test1"
testGroup2
=
"test2"
testUser1
=
"user1"
testUser2
=
"user2"
)
func
stringInSlice
(
slice
[]
string
,
search
string
)
bool
{
...
...
This diff is collapsed.
Click to expand it.
store/types.go
+
51
−
51
View file @
9dbb76f2
...
...
@@ -56,58 +56,58 @@ func (g Group) String() string {
//******* Files
// type ImportState int
// const (
// ImportNew ImportState = iota
// ImportPending
// ImportRunning
// ImportDone
// ImportAborted
// )
// func (s ImportState) String() string {
// switch s {
// case ImportNew:
// return "new"
// case ImportPending:
// return "pending"
// case ImportRunning:
// return "running"
// case ImportDone:
// return "done"
// case ImportAborted:
// return "aborted"
// }
// return "unknown"
// }
type
ImportState
int
// func (s *ImportState) fromString(str string) error {
// switch str {
// case "new":
// *s = ImportNew
// case "pending":
// *s = ImportPending
// case "running":
// *s = ImportRunning
// case "done":
// *s = ImportDone
// case "aborted":
// *s = ImportAborted
// default:
// return errors.New("invalid import state: '" + str + "'")
// }
// return nil
// }
const
(
ImportNew
ImportState
=
iota
ImportPending
ImportRunning
ImportDone
ImportAborted
)
// func (s ImportState) MarshalText() (data []byte, err error) {
// data = []byte(s.String())
// return
// }
func
(
s
ImportState
)
String
()
string
{
switch
s
{
case
ImportNew
:
return
"new"
case
ImportPending
:
return
"pending"
case
ImportRunning
:
return
"running"
case
ImportDone
:
return
"done"
case
ImportAborted
:
return
"aborted"
}
return
"unknown"
}
// func (s *ImportState) UnmarshalText(data []byte) (err error) {
// return s.fromString(string(data))
// }
func
(
s
*
ImportState
)
fromString
(
str
string
)
error
{
switch
str
{
case
"new"
:
*
s
=
ImportNew
case
"pending"
:
*
s
=
ImportPending
case
"running"
:
*
s
=
ImportRunning
case
"done"
:
*
s
=
ImportDone
case
"aborted"
:
*
s
=
ImportAborted
default
:
return
errors
.
New
(
"invalid import state: '"
+
str
+
"'"
)
}
return
nil
}
func
(
s
ImportState
)
MarshalText
()
(
data
[]
byte
,
err
error
)
{
data
=
[]
byte
(
s
.
String
())
return
}
func
(
s
*
ImportState
)
UnmarshalText
(
data
[]
byte
)
(
err
error
)
{
return
s
.
fromString
(
string
(
data
))
}
// type ImportLogLine struct {
// Timestamp time.Time `json:"timestamp"`
...
...
@@ -121,8 +121,8 @@ func (g Group) String() string {
// }
type
Import
struct
{
//
State ImportState `json:"state"`
Success
bool
`json:"success"`
State
ImportState
`json:"state"`
Success
bool
`json:"success"`
// Log ImportLog `json:"log"`
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment