files

package
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 4, 2020 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConfigerNewer

type ConfigerNewer struct{}

ConfigerNewer implements the factory methods for the files provider.

func (*ConfigerNewer) Config

func (cn *ConfigerNewer) Config() error

Config takes input from the user to configure the sqlite3 provider.

func (*ConfigerNewer) New

func (cn *ConfigerNewer) New() (storage.Provider, error)

New returns a usable instance of the sqlite3 provider.

type FileAlias

type FileAlias struct {
	Alias          string    `json:"alias"`
	Domain         string    `json:"domain"`
	EmailAddresses []string  `json:"email_addresses"`
	Description    string    `json:"description"`
	Suspended      bool      `json:"suspended"`
	CreatedTS      time.Time `json:"created_ts"`
	ModifiedTS     time.Time `json:"modified_ts"`
	SuspendedTS    time.Time `json:"suspended_ts"`
}

FileAlias represents the state necessary for a file alias.

type Storer

type Storer struct {
	// contains filtered or unexported fields
}

Storer implements the storage provder methods and state for the files provider.

func (*Storer) Close

func (s *Storer) Close() error

Close for the files provider is a no-op currently.

func (Storer) Delete

func (s Storer) Delete(a, d string) error

Delete removes the row from the database representing the alias. An error is returned if there is a failure interacting with database.

func (Storer) Description

func (s Storer) Description() string

Description returns the description of the provider this package implements

func (Storer) Get

func (s Storer) Get(alias, domain string) (*alias.Alias, error)

Get retrieves a single Alias from the file on disk. A pointer to the Alias is returned with any error condition during retrieval.

func (*Storer) Open

func (s *Storer) Open(readOnly bool) error

Open reads the JSON files from the path set in the files_path configuration key. The readOnly argument determines if mutating functions can operate on the files. If the storage directory does not exist, it is created (assuming the files were not opened with readOnly set). An error is returned if there is a problem opening the files.

func (Storer) Put

func (s Storer) Put(a alias.Alias, updateModified bool) error

Put stores the Alias in a file. If the updateModified flag is set, the modified timestamp field is updated with the timestamp of when the Put call was made. The error condition of the Put operation is returned.

func (Storer) Search

func (s Storer) Search(f alias.Filter, matchAnyRegexp bool) (alias.Aliases, error)

Search applies the filter to the database query results and returns a sorted list of aliases that match the filter criteria.

func (Storer) Suspend

func (s Storer) Suspend(alias, domain string) error

Suspend updates the row in the database representing the alias with the suspended flag is true and updates the suspended timestamp. An error is returned if there is a failure interacting with the database.

func (Storer) Type

func (s Storer) Type() string

Type returns the type of provider this package implements

func (Storer) Unsuspend

func (s Storer) Unsuspend(alias, domain string) error

Unsuspend updates the row in the database representing the alias with the suspended flag is false and updates the suspended timestamp. An error is returned if there is a failure interacting with the database.

func (Storer) Update

func (s Storer) Update(a alias.Alias, updateModified bool) error

Update stores the updated Alias in the database. If the updateModified flag is set, the modified timestamp column is updated with the timestamp of when the Update call was made. The error condition of the Update operation is returned.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL