diff --git a/CHANGELOG.md b/CHANGELOG.md index 69bcbd8..61c084a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ Which is based on [Keep A Changelog](http://keepachangelog.com/) ### Added - Test build with travis +- Add entry's fields Create and LastUpdate ### Changed diff --git a/gpm/entry.go b/gpm/entry.go index 410a41b..8e382c0 100644 --- a/gpm/entry.go +++ b/gpm/entry.go @@ -24,14 +24,16 @@ import( // Entry struct have the password informations type Entry struct { - Name string `yaml:"name"` - ID string `yaml:"id"` - URI string `yaml:"uri"` - User string `yaml:"login"` - Password string `yaml:"password"` - OTP string `yaml:"otp"` - Group string `yaml:"group"` - Comment string `yaml:"comment"` + Name string + ID string + URI string + User string + Password string + OTP string + Group string + Comment string + Create int64 + LastUpdate int64 } // Verify if the item have'nt error diff --git a/gpm/wallet.go b/gpm/wallet.go index 49360a5..0a4f69a 100644 --- a/gpm/wallet.go +++ b/gpm/wallet.go @@ -21,6 +21,7 @@ import ( "math/rand" "os" "regexp" + "time" "sort" "strings" ) @@ -151,6 +152,8 @@ func (w *Wallet) AddEntry(entry Entry) error { return fmt.Errorf("the id already exists in wallet, can't add the entry") } + entry.Create = time.Now().Unix() + entry.LastUpdate = entry.Create w.Entries = append(w.Entries, entry) return nil @@ -180,6 +183,7 @@ func (w *Wallet) UpdateEntry(entry Entry) error { return err } + entry.LastUpdate = time.Now().Unix() for index, i := range w.Entries { if entry.ID == i.ID { w.Entries[index] = entry