mirror of
https://github.com/balzack/databag.git
synced 2025-02-14 12:39:17 +00:00
more golint renaming
This commit is contained in:
parent
d5e8fc7394
commit
c20ec46e1c
@ -392,14 +392,14 @@ type TestApp struct {
|
||||
condition *TestCondition
|
||||
}
|
||||
|
||||
func (a *TestApp) UpdateProfile() (err error) {
|
||||
func (a *TestApp) updateProfile() (err error) {
|
||||
params := &TestAPIParams{ query: "/profile", tokenType: APPTokenAgent, token: a.token }
|
||||
response := &TestAPIResponse{ data: &a.profile }
|
||||
err = TestAPIRequest(GetProfile, params, response)
|
||||
return
|
||||
}
|
||||
|
||||
func (a *TestApp) UpdateGroups() (err error) {
|
||||
func (a *TestApp) updateGroups() (err error) {
|
||||
var groups []Group
|
||||
if a.revision.Group == 0 {
|
||||
params := &TestAPIParams{ query: "/groups", tokenType: APPTokenAgent, token: a.token }
|
||||
@ -425,7 +425,7 @@ func (a *TestApp) UpdateGroups() (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
func (a *TestApp) UpdateArticles() (err error) {
|
||||
func (a *TestApp) updateArticles() (err error) {
|
||||
var articles []Article
|
||||
if a.revision.Article == 0 {
|
||||
params := &TestAPIParams{ query: "/articles", tokenType: APPTokenAgent, token: a.token }
|
||||
@ -451,7 +451,7 @@ func (a *TestApp) UpdateArticles() (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
func (a *TestApp) UpdateChannels() (err error) {
|
||||
func (a *TestApp) updateChannels() (err error) {
|
||||
var channels []Channel
|
||||
if a.revision.Channel == 0 {
|
||||
params := &TestAPIParams{ query: "/channels", tokenType: APPTokenAgent, token: a.token }
|
||||
@ -475,7 +475,7 @@ func (a *TestApp) UpdateChannels() (err error) {
|
||||
storeChannel, set := a.channels[channel.ID]
|
||||
if set {
|
||||
if channel.Revision != storeChannel.channel.Revision {
|
||||
if err = a.UpdateChannel(storeChannel, &channel); err != nil {
|
||||
if err = a.updateChannel(storeChannel, &channel); err != nil {
|
||||
return
|
||||
}
|
||||
storeChannel.channel.Revision = channel.Revision
|
||||
@ -483,7 +483,7 @@ func (a *TestApp) UpdateChannels() (err error) {
|
||||
} else {
|
||||
storeChannel := &TestChannel{ channel: Channel{ ID: channel.ID, Data: &ChannelData{} } }
|
||||
a.channels[channel.ID] = storeChannel
|
||||
if err = a.UpdateChannel(storeChannel, &channel); err != nil {
|
||||
if err = a.updateChannel(storeChannel, &channel); err != nil {
|
||||
return
|
||||
}
|
||||
storeChannel.channel.Revision = channel.Revision
|
||||
@ -493,10 +493,10 @@ func (a *TestApp) UpdateChannels() (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
func (a *TestApp) UpdateChannel(storeChannel *TestChannel, channel *Channel) (err error) {
|
||||
func (a *TestApp) updateChannel(storeChannel *TestChannel, channel *Channel) (err error) {
|
||||
if storeChannel.channel.Revision != channel.Revision {
|
||||
if storeChannel.channel.Data.TopicRevision != channel.Data.TopicRevision {
|
||||
if err = a.UpdateChannelTopics(storeChannel); err != nil {
|
||||
if err = a.updateChannelTopics(storeChannel); err != nil {
|
||||
return
|
||||
}
|
||||
storeChannel.channel.Data.TopicRevision = channel.Data.TopicRevision
|
||||
@ -523,7 +523,7 @@ func (a *TestApp) UpdateChannel(storeChannel *TestChannel, channel *Channel) (er
|
||||
return
|
||||
}
|
||||
|
||||
func (a *TestApp) UpdateChannelTopics(storeChannel *TestChannel) (err error) {
|
||||
func (a *TestApp) updateChannelTopics(storeChannel *TestChannel) (err error) {
|
||||
var topics []Topic
|
||||
if storeChannel.channel.Revision == 0 {
|
||||
params := &TestAPIParams{ query: "/channels/{channelID}/topics",
|
||||
@ -550,7 +550,7 @@ func (a *TestApp) UpdateChannelTopics(storeChannel *TestChannel) (err error) {
|
||||
storeTopic, set := storeChannel.topics[topic.ID]
|
||||
if set {
|
||||
if topic.Revision != storeTopic.topic.Revision {
|
||||
if err = a.UpdateChannelTopic(storeChannel, storeTopic, &topic); err != nil {
|
||||
if err = a.updateChannelTopic(storeChannel, storeTopic, &topic); err != nil {
|
||||
return
|
||||
}
|
||||
storeTopic.topic.Revision = topic.Revision
|
||||
@ -558,7 +558,7 @@ func (a *TestApp) UpdateChannelTopics(storeChannel *TestChannel) (err error) {
|
||||
} else {
|
||||
storeTopic := &TestTopic{ topic: Topic{ ID: topic.ID, Data: &TopicData{} } }
|
||||
storeChannel.topics[topic.ID] = storeTopic
|
||||
if err = a.UpdateChannelTopic(storeChannel, storeTopic, &topic); err != nil {
|
||||
if err = a.updateChannelTopic(storeChannel, storeTopic, &topic); err != nil {
|
||||
return
|
||||
}
|
||||
storeTopic.topic.Revision = topic.Revision
|
||||
@ -568,10 +568,10 @@ func (a *TestApp) UpdateChannelTopics(storeChannel *TestChannel) (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
func (a *TestApp) UpdateChannelTopic(storeChannel *TestChannel, storeTopic *TestTopic, topic *Topic) (err error) {
|
||||
func (a *TestApp) updateChannelTopic(storeChannel *TestChannel, storeTopic *TestTopic, topic *Topic) (err error) {
|
||||
if storeTopic.topic.Revision != topic.Revision {
|
||||
if storeTopic.topic.Data.TagRevision != topic.Data.TagRevision {
|
||||
if err = a.UpdateChannelTopicTags(storeChannel, storeTopic); err != nil {
|
||||
if err = a.updateChannelTopicTags(storeChannel, storeTopic); err != nil {
|
||||
return
|
||||
}
|
||||
storeTopic.topic.Data.TagRevision = topic.Data.TagRevision
|
||||
@ -599,7 +599,7 @@ func (a *TestApp) UpdateChannelTopic(storeChannel *TestChannel, storeTopic *Test
|
||||
return
|
||||
}
|
||||
|
||||
func (a *TestApp) UpdateChannelTopicTags(storeChannel *TestChannel, storeTopic *TestTopic) (err error) {
|
||||
func (a *TestApp) updateChannelTopicTags(storeChannel *TestChannel, storeTopic *TestTopic) (err error) {
|
||||
var tags []Tag
|
||||
if storeTopic.topic.Revision == 0 {
|
||||
params := &TestAPIParams{ query: "/channels/{channelID}/topics/{topicID}/tags",
|
||||
@ -631,7 +631,7 @@ func (a *TestApp) UpdateChannelTopicTags(storeChannel *TestChannel, storeTopic *
|
||||
return
|
||||
}
|
||||
|
||||
func (a *TestApp) UpdateCards() (err error) {
|
||||
func (a *TestApp) updateCards() (err error) {
|
||||
var cards []Card
|
||||
if a.revision.Card == 0 {
|
||||
params := &TestAPIParams{ query: "/cards", tokenType: APPTokenAgent, token: a.token }
|
||||
@ -701,12 +701,12 @@ func (a *TestApp) UpdateCards() (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
func (a *TestApp) UpdateApp(rev *Revision) {
|
||||
func (a *TestApp) updateApp(rev *Revision) {
|
||||
a.mutex.Lock()
|
||||
defer a.mutex.Unlock()
|
||||
|
||||
if rev.Profile != a.revision.Profile {
|
||||
if err := a.UpdateProfile(); err != nil {
|
||||
if err := a.updateProfile(); err != nil {
|
||||
PrintMsg(err)
|
||||
} else {
|
||||
a.revision.Profile = rev.Profile
|
||||
@ -714,7 +714,7 @@ func (a *TestApp) UpdateApp(rev *Revision) {
|
||||
}
|
||||
|
||||
if rev.Group != a.revision.Group {
|
||||
if err := a.UpdateGroups(); err != nil {
|
||||
if err := a.updateGroups(); err != nil {
|
||||
PrintMsg(err)
|
||||
} else {
|
||||
a.revision.Group = rev.Group
|
||||
@ -722,7 +722,7 @@ func (a *TestApp) UpdateApp(rev *Revision) {
|
||||
}
|
||||
|
||||
if rev.Article != a.revision.Article {
|
||||
if err := a.UpdateArticles(); err != nil {
|
||||
if err := a.updateArticles(); err != nil {
|
||||
PrintMsg(err)
|
||||
} else {
|
||||
a.revision.Article = rev.Article
|
||||
@ -730,7 +730,7 @@ func (a *TestApp) UpdateApp(rev *Revision) {
|
||||
}
|
||||
|
||||
if rev.Card != a.revision.Card {
|
||||
if err := a.UpdateCards(); err != nil {
|
||||
if err := a.updateCards(); err != nil {
|
||||
PrintMsg(err)
|
||||
} else {
|
||||
a.revision.Card = rev.Card
|
||||
@ -738,7 +738,7 @@ func (a *TestApp) UpdateApp(rev *Revision) {
|
||||
}
|
||||
|
||||
if rev.Channel != a.revision.Channel {
|
||||
if err := a.UpdateChannels(); err != nil {
|
||||
if err := a.updateChannels(); err != nil {
|
||||
PrintMsg(err)
|
||||
} else {
|
||||
a.revision.Channel = rev.Channel
|
||||
@ -767,7 +767,7 @@ func (a *TestApp) Connect(token string) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
a.UpdateApp(&revision)
|
||||
a.updateApp(&revision)
|
||||
|
||||
// reset any timeout
|
||||
ws.SetReadDeadline(time.Time{})
|
||||
@ -784,7 +784,7 @@ func (a *TestApp) Connect(token string) error {
|
||||
if err = json.Unmarshal(data, rev); err != nil {
|
||||
return errors.New("invalid status data")
|
||||
}
|
||||
a.UpdateApp(rev)
|
||||
a.updateApp(rev)
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -19,28 +19,28 @@ import (
|
||||
const testReadDeadline = 2
|
||||
const testRevisionWait = 100
|
||||
|
||||
type TestCard struct {
|
||||
type testCard struct {
|
||||
GUID string
|
||||
Token string
|
||||
CardID string
|
||||
GroupID string
|
||||
}
|
||||
|
||||
type TestContact struct {
|
||||
type testContact struct {
|
||||
GUID string
|
||||
Token string
|
||||
Revisions chan *Revision
|
||||
A TestCard
|
||||
B TestCard
|
||||
C TestCard
|
||||
D TestCard
|
||||
A testCard
|
||||
B testCard
|
||||
C testCard
|
||||
D testCard
|
||||
}
|
||||
|
||||
type TestGroup struct {
|
||||
A TestContact
|
||||
B TestContact
|
||||
C TestContact
|
||||
D TestContact
|
||||
A testContact
|
||||
B testContact
|
||||
C testContact
|
||||
D testContact
|
||||
}
|
||||
|
||||
func GetTestRevision(status chan *Revision) (rev *Revision) {
|
||||
@ -253,6 +253,8 @@ func APITestUpload(
|
||||
// |/ \|
|
||||
// C --- connected,group connected,group --- D
|
||||
//
|
||||
|
||||
// AddTestGroup creates and connects test accounts for useCases
|
||||
func AddTestGroup(prefix string) (*TestGroup, error) {
|
||||
var err error
|
||||
var rev *Revision
|
||||
@ -260,110 +262,110 @@ func AddTestGroup(prefix string) (*TestGroup, error) {
|
||||
|
||||
// allocate contacts
|
||||
g := &TestGroup{}
|
||||
if g.A.GUID, g.A.Token, err = AddTestAccount(prefix+"A"); err != nil {
|
||||
if g.A.GUID, g.A.Token, err = addTestAccount(prefix+"A"); err != nil {
|
||||
return g, err
|
||||
}
|
||||
if g.B.GUID, g.B.Token, err = AddTestAccount(prefix+"B"); err != nil {
|
||||
if g.B.GUID, g.B.Token, err = addTestAccount(prefix+"B"); err != nil {
|
||||
return g, err
|
||||
}
|
||||
if g.C.GUID, g.C.Token, err = AddTestAccount(prefix+"C"); err != nil {
|
||||
if g.C.GUID, g.C.Token, err = addTestAccount(prefix+"C"); err != nil {
|
||||
return g, err
|
||||
}
|
||||
if g.D.GUID, g.D.Token, err = AddTestAccount(prefix+"D"); err != nil {
|
||||
if g.D.GUID, g.D.Token, err = addTestAccount(prefix+"D"); err != nil {
|
||||
return g, err
|
||||
}
|
||||
|
||||
// setup A
|
||||
if g.A.B.CardID, err = AddTestCard(g.A.Token, g.B.Token); err != nil {
|
||||
if g.A.B.CardID, err = addTestCard(g.A.Token, g.B.Token); err != nil {
|
||||
return g, err
|
||||
}
|
||||
if err = OpenTestCard(g.A.Token, g.A.B.CardID); err != nil {
|
||||
if err = openTestCard(g.A.Token, g.A.B.CardID); err != nil {
|
||||
return g, err
|
||||
}
|
||||
if g.A.B.GroupID, err = GroupTestCard(g.A.Token, g.A.B.CardID); err != nil {
|
||||
if g.A.B.GroupID, err = groupTestCard(g.A.Token, g.A.B.CardID); err != nil {
|
||||
return g, err
|
||||
}
|
||||
if g.A.C.CardID, err = AddTestCard(g.A.Token, g.C.Token); err != nil {
|
||||
if g.A.C.CardID, err = addTestCard(g.A.Token, g.C.Token); err != nil {
|
||||
return g, err
|
||||
}
|
||||
if err = OpenTestCard(g.A.Token, g.A.C.CardID); err != nil {
|
||||
if err = openTestCard(g.A.Token, g.A.C.CardID); err != nil {
|
||||
return g, err
|
||||
}
|
||||
if g.A.C.GroupID, err = GroupTestCard(g.A.Token, g.A.C.CardID); err != nil {
|
||||
if g.A.C.GroupID, err = groupTestCard(g.A.Token, g.A.C.CardID); err != nil {
|
||||
return g, err
|
||||
}
|
||||
if g.A.D.CardID, err = AddTestCard(g.A.Token, g.D.Token); err != nil {
|
||||
if g.A.D.CardID, err = addTestCard(g.A.Token, g.D.Token); err != nil {
|
||||
return g, err
|
||||
}
|
||||
if err = OpenTestCard(g.A.Token, g.A.D.CardID); err != nil {
|
||||
if err = openTestCard(g.A.Token, g.A.D.CardID); err != nil {
|
||||
return g, err
|
||||
}
|
||||
|
||||
// setup B
|
||||
if g.B.A.CardID, err = AddTestCard(g.B.Token, g.A.Token); err != nil {
|
||||
if g.B.A.CardID, err = addTestCard(g.B.Token, g.A.Token); err != nil {
|
||||
return g, err
|
||||
}
|
||||
if err = OpenTestCard(g.B.Token, g.B.A.CardID); err != nil {
|
||||
if err = openTestCard(g.B.Token, g.B.A.CardID); err != nil {
|
||||
return g, err
|
||||
}
|
||||
if g.B.A.GroupID, err = GroupTestCard(g.B.Token, g.B.A.CardID); err != nil {
|
||||
if g.B.A.GroupID, err = groupTestCard(g.B.Token, g.B.A.CardID); err != nil {
|
||||
return g, err
|
||||
}
|
||||
if g.B.C.CardID, err = AddTestCard(g.B.Token, g.C.Token); err != nil {
|
||||
if g.B.C.CardID, err = addTestCard(g.B.Token, g.C.Token); err != nil {
|
||||
return g, err
|
||||
}
|
||||
if g.B.C.GroupID, err = GroupTestCard(g.B.Token, g.B.C.CardID); err != nil {
|
||||
if g.B.C.GroupID, err = groupTestCard(g.B.Token, g.B.C.CardID); err != nil {
|
||||
return g, err
|
||||
}
|
||||
|
||||
// setup C
|
||||
if g.C.D.CardID, err = AddTestCard(g.C.Token, g.D.Token); err != nil {
|
||||
if g.C.D.CardID, err = addTestCard(g.C.Token, g.D.Token); err != nil {
|
||||
return g, err
|
||||
}
|
||||
if err = OpenTestCard(g.C.Token, g.C.D.CardID); err != nil {
|
||||
if err = openTestCard(g.C.Token, g.C.D.CardID); err != nil {
|
||||
return g, err
|
||||
}
|
||||
if g.C.D.GroupID, err = GroupTestCard(g.C.Token, g.C.D.CardID); err != nil {
|
||||
if g.C.D.GroupID, err = groupTestCard(g.C.Token, g.C.D.CardID); err != nil {
|
||||
return g, err
|
||||
}
|
||||
if g.C.A.CardID, err = AddTestCard(g.C.Token, g.A.Token); err != nil {
|
||||
if g.C.A.CardID, err = addTestCard(g.C.Token, g.A.Token); err != nil {
|
||||
return g, err
|
||||
}
|
||||
if err = OpenTestCard(g.C.Token, g.C.A.CardID); err != nil {
|
||||
if err = openTestCard(g.C.Token, g.C.A.CardID); err != nil {
|
||||
return g, err
|
||||
}
|
||||
if g.C.A.GroupID, err = GroupTestCard(g.C.Token, g.C.A.CardID); err != nil {
|
||||
if g.C.A.GroupID, err = groupTestCard(g.C.Token, g.C.A.CardID); err != nil {
|
||||
return g, err
|
||||
}
|
||||
|
||||
// setup D
|
||||
if g.D.C.CardID, err = AddTestCard(g.D.Token, g.C.Token); err != nil {
|
||||
if g.D.C.CardID, err = addTestCard(g.D.Token, g.C.Token); err != nil {
|
||||
return g, err
|
||||
}
|
||||
if err = OpenTestCard(g.D.Token, g.D.C.CardID); err != nil {
|
||||
if err = openTestCard(g.D.Token, g.D.C.CardID); err != nil {
|
||||
return g, err
|
||||
}
|
||||
if g.D.C.GroupID, err = GroupTestCard(g.D.Token, g.D.C.CardID); err != nil {
|
||||
if g.D.C.GroupID, err = groupTestCard(g.D.Token, g.D.C.CardID); err != nil {
|
||||
return g, err
|
||||
}
|
||||
if g.D.A.CardID, err = GetCardID(g.D.Token, g.A.GUID); err != nil {
|
||||
if g.D.A.CardID, err = getCardID(g.D.Token, g.A.GUID); err != nil {
|
||||
return g, err
|
||||
}
|
||||
|
||||
// get contact tokens
|
||||
if g.A.B.Token, err = GetCardToken(g.A.Token, g.A.B.CardID); err != nil {
|
||||
if g.A.B.Token, err = getCardToken(g.A.Token, g.A.B.CardID); err != nil {
|
||||
return g, err
|
||||
}
|
||||
if g.B.A.Token, err = GetCardToken(g.B.Token, g.B.A.CardID); err != nil {
|
||||
if g.B.A.Token, err = getCardToken(g.B.Token, g.B.A.CardID); err != nil {
|
||||
return g, err
|
||||
}
|
||||
if g.C.A.Token, err = GetCardToken(g.C.Token, g.C.A.CardID); err != nil {
|
||||
if g.C.A.Token, err = getCardToken(g.C.Token, g.C.A.CardID); err != nil {
|
||||
return g, err
|
||||
}
|
||||
if g.C.D.Token, err = GetCardToken(g.C.Token, g.C.D.CardID); err != nil {
|
||||
if g.C.D.Token, err = getCardToken(g.C.Token, g.C.D.CardID); err != nil {
|
||||
return g, err
|
||||
}
|
||||
if g.D.C.Token, err = GetCardToken(g.D.Token, g.D.C.CardID); err != nil {
|
||||
if g.D.C.Token, err = getCardToken(g.D.Token, g.D.C.CardID); err != nil {
|
||||
return g, err
|
||||
}
|
||||
|
||||
@ -374,34 +376,34 @@ func AddTestGroup(prefix string) (*TestGroup, error) {
|
||||
}
|
||||
g.A.Revisions = make(chan *Revision, 64)
|
||||
g.A.Revisions <- rev
|
||||
go MonitorStatus(ws, &g.A);
|
||||
go monitorStatus(ws, &g.A);
|
||||
rev = &Revision{}
|
||||
if ws, err = StatusConnection(g.B.Token, rev); err != nil {
|
||||
return g, err
|
||||
}
|
||||
g.B.Revisions = make(chan *Revision, 64)
|
||||
g.B.Revisions <- rev
|
||||
go MonitorStatus(ws, &g.B);
|
||||
go monitorStatus(ws, &g.B);
|
||||
rev = &Revision{}
|
||||
if ws, err = StatusConnection(g.C.Token, rev); err != nil {
|
||||
return g, err
|
||||
}
|
||||
g.C.Revisions = make(chan *Revision, 64)
|
||||
g.C.Revisions <- rev
|
||||
go MonitorStatus(ws, &g.C);
|
||||
go monitorStatus(ws, &g.C);
|
||||
rev = &Revision{}
|
||||
if ws, err = StatusConnection(g.D.Token, rev); err != nil {
|
||||
return g, err
|
||||
}
|
||||
g.D.Revisions = make(chan *Revision, 64)
|
||||
g.D.Revisions <- rev
|
||||
go MonitorStatus(ws, &g.D);
|
||||
go monitorStatus(ws, &g.D);
|
||||
|
||||
return g, nil
|
||||
}
|
||||
|
||||
|
||||
func MonitorStatus(ws *websocket.Conn, contact *TestContact) {
|
||||
func monitorStatus(ws *websocket.Conn, contact *testContact) {
|
||||
var data []byte
|
||||
var dataType int
|
||||
var err error
|
||||
@ -428,7 +430,7 @@ func MonitorStatus(ws *websocket.Conn, contact *TestContact) {
|
||||
}
|
||||
}
|
||||
|
||||
func GetCardToken(account string, cardID string) (token string, err error) {
|
||||
func getCardToken(account string, cardID string) (token string, err error) {
|
||||
var r *http.Request
|
||||
var w *httptest.ResponseRecorder
|
||||
var cardDetail CardDetail
|
||||
@ -462,7 +464,7 @@ func GetCardToken(account string, cardID string) (token string, err error) {
|
||||
return
|
||||
}
|
||||
|
||||
func GetCardID(account string, guid string) (cardID string, err error) {
|
||||
func getCardID(account string, guid string) (cardID string, err error) {
|
||||
var r *http.Request
|
||||
var w *httptest.ResponseRecorder
|
||||
var cards []Card
|
||||
@ -485,7 +487,7 @@ func GetCardID(account string, guid string) (cardID string, err error) {
|
||||
return
|
||||
}
|
||||
|
||||
func GroupTestCard(account string, cardID string) (groupID string, err error) {
|
||||
func groupTestCard(account string, cardID string) (groupID string, err error) {
|
||||
var r *http.Request
|
||||
var w *httptest.ResponseRecorder
|
||||
var subject *Subject
|
||||
@ -522,7 +524,7 @@ func GroupTestCard(account string, cardID string) (groupID string, err error) {
|
||||
return
|
||||
}
|
||||
|
||||
func OpenTestCard(account string, cardID string) (err error) {
|
||||
func openTestCard(account string, cardID string) (err error) {
|
||||
var r *http.Request
|
||||
var w *httptest.ResponseRecorder
|
||||
var msg DataMessage
|
||||
@ -577,7 +579,7 @@ func OpenTestCard(account string, cardID string) (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
func AddTestCard(account string, contact string) (cardID string, err error) {
|
||||
func addTestCard(account string, contact string) (cardID string, err error) {
|
||||
var r *http.Request
|
||||
var w *httptest.ResponseRecorder
|
||||
var msg DataMessage
|
||||
@ -604,7 +606,7 @@ func AddTestCard(account string, contact string) (cardID string, err error) {
|
||||
return
|
||||
}
|
||||
|
||||
func AddTestAccount(username string) (guid string, token string, err error) {
|
||||
func addTestAccount(username string) (guid string, token string, err error) {
|
||||
var r *http.Request
|
||||
var w *httptest.ResponseRecorder
|
||||
|
||||
|
@ -94,7 +94,7 @@ func transcodeAsset(asset *store.Asset) {
|
||||
|
||||
if !re.MatchString(asset.Transform) {
|
||||
ErrMsg(errors.New("invalid transform"))
|
||||
if err := UpdateAsset(asset, APPAssetError, 0, 0); err != nil {
|
||||
if err := updateAsset(asset, APPAssetError, 0, 0); err != nil {
|
||||
ErrMsg(err)
|
||||
}
|
||||
} else {
|
||||
@ -110,7 +110,7 @@ func transcodeAsset(asset *store.Asset) {
|
||||
LogMsg(stdout.String())
|
||||
LogMsg(stderr.String())
|
||||
ErrMsg(err)
|
||||
if err := UpdateAsset(asset, APPAssetError, 0, 0); err != nil {
|
||||
if err := updateAsset(asset, APPAssetError, 0, 0); err != nil {
|
||||
ErrMsg(err)
|
||||
}
|
||||
} else {
|
||||
@ -120,21 +120,21 @@ func transcodeAsset(asset *store.Asset) {
|
||||
if stderr.Len() > 0 {
|
||||
LogMsg(stderr.String())
|
||||
}
|
||||
crc, size, err := ScanAsset(output)
|
||||
crc, size, err := scanAsset(output)
|
||||
|
||||
if err != nil {
|
||||
ErrMsg(err)
|
||||
if err := UpdateAsset(asset, APPAssetError, 0, 0); err != nil {
|
||||
if err := updateAsset(asset, APPAssetError, 0, 0); err != nil {
|
||||
ErrMsg(err)
|
||||
}
|
||||
} else if err := UpdateAsset(asset, APPAssetReady, crc, size); err != nil {
|
||||
} else if err := updateAsset(asset, APPAssetReady, crc, size); err != nil {
|
||||
ErrMsg(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func UpdateAsset(asset *store.Asset, status string, crc uint32, size int64) (err error) {
|
||||
func updateAsset(asset *store.Asset, status string, crc uint32, size int64) (err error) {
|
||||
|
||||
topic := store.Topic{};
|
||||
err = store.DB.Transaction(func(tx *gorm.DB) error {
|
||||
@ -191,7 +191,7 @@ func UpdateAsset(asset *store.Asset, status string, crc uint32, size int64) (err
|
||||
return
|
||||
}
|
||||
|
||||
func ScanAsset(path string) (crc uint32, size int64, err error) {
|
||||
func scanAsset(path string) (crc uint32, size int64, err error) {
|
||||
|
||||
file, res := os.Open(path)
|
||||
if res != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user