Make argument order of setRandomDefault consistent

Most of the other private CRUD methods have a consistent argument order
of a context, a source, then a transaction. setRandomDefault had two of
these args transposed, so this swaps them to be consistent with the rest
of the methods.
pull/403/head
Tim Raymond 2016-11-08 12:29:29 -05:00
parent 5e39e4602a
commit 9c7c116650
1 changed files with 2 additions and 2 deletions

View File

@ -57,7 +57,7 @@ func (s *SourcesStore) Add(ctx context.Context, src chronograf.Source) (chronogr
// Delete removes the Source from the SourcesStore
func (s *SourcesStore) Delete(ctx context.Context, src chronograf.Source) error {
if err := s.client.db.Update(func(tx *bolt.Tx) error {
if err := s.setRandomDefault(ctx, tx, src); err != nil {
if err := s.setRandomDefault(ctx, src, tx); err != nil {
return err
}
return s.delete(ctx, src, tx)
@ -196,7 +196,7 @@ func (s *SourcesStore) resetDefaultSource(ctx context.Context, tx *bolt.Tx) erro
// chronograf.Source and set it as the default source. If no other sources are
// available, the provided source will be set to the default source if is not
// already. It assumes that the provided chronograf.Source has been persisted.
func (s *SourcesStore) setRandomDefault(ctx context.Context, tx *bolt.Tx, src chronograf.Source) error {
func (s *SourcesStore) setRandomDefault(ctx context.Context, src chronograf.Source, tx *bolt.Tx) error {
// Check if requested source is the current default
if target, err := s.get(ctx, src.ID, tx); err != nil {
return err