Documentation ¶
Index ¶
- type Store
- func (s *Store) BackUpMissingFacts(username, email, phone fact.Fact) error
- func (s *Store) ConfirmFact(confirmationId string) error
- func (s *Store) DeleteFact(f fact.Fact) error
- func (s *Store) GetFacts() []fact.Fact
- func (s *Store) GetStringifiedFacts() []string
- func (s *Store) GetUsername() (string, error)
- func (s *Store) RestoreFromBackUp(backupData fact.FactList) error
- func (s *Store) StoreUnconfirmedFact(confirmationId string, f fact.Fact) error
- func (s *Store) StoreUsername(f fact.Fact) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store is the storage object for the higher level ud.Manager object. This storage implementation is written for client side.
func NewOrLoadStore ¶
NewOrLoadStore loads the Store object from the provided versioned.KV.
func (*Store) BackUpMissingFacts ¶
BackUpMissingFacts adds a registered fact to the Store object. It can take in both an email and a phone number. One or the other may be an empty string, however both is considered an error. It checks for each whether that fact type already exists in the structure. If a fact type already exists, an error is returned. ************************************************************************ NOTE: This is done since BackUpMissingFacts is exposed to the bindings layer. This prevents front end from using this as the method to store facts on their end, which is not its intended use case. It's intended use case is to store already registered facts, prior to the creation of this function. We handle storage of newly registered internally using Store.ConfirmFact. ************************************************************************ Any other fact.FactType is not accepted and returns an error and nothing is backed up. If you attempt to back up a fact type that has already been backed up, an error will be returned and nothing will be backed up. Otherwise, it adds the fact and returns whether the Store saved successfully.
func (*Store) ConfirmFact ¶
ConfirmFact will delete the fact from the unconfirmed store and add it to the confirmed fact store. The Store will then be saved
func (*Store) DeleteFact ¶
DeleteFact is our internal use function which will delete the registered fact from memory and storage. An error is returned if the fact does not exist in memory.
func (*Store) GetFacts ¶
GetFacts returns a list of fact.Fact objects that exist within the Store's confirmedFacts map.
func (*Store) GetStringifiedFacts ¶
GetStringifiedFacts returns a list of stringified facts from the Store's confirmedFacts map.
func (*Store) GetUsername ¶
GetUsername retrieves the username from the Store object. If it is not directly in the Store's username field, it is searched for in the map.
func (*Store) RestoreFromBackUp ¶
RestoreFromBackUp initializes the confirmedFacts map with the backed up fact data. This will error if the store is already stateful.
func (*Store) StoreUnconfirmedFact ¶
StoreUnconfirmedFact stores a fact that has been added to UD but has not been confirmed by the user. It is keyed on the confirmation ID given by UD.