db

package
v0.0.0-...-b1bd2f5 Latest Latest
Warning

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

Go to latest
Published: May 7, 2019 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Migrations migrate.MigrationSource = &migrate.AssetMigrationSource{
	Asset:    Asset,
	AssetDir: AssetDir,
	Dir:      "migrations",
}

Migrations represents all of the schema migration

Functions

func Asset

func Asset(name string) ([]byte, error)

Asset loads and returns the asset for the given name. It returns an error if the asset could not be found or could not be loaded.

func AssetDir

func AssetDir(name string) ([]string, error)

AssetDir returns the file names below a certain directory embedded in the file by go-bindata. For example if you run go-bindata on data/... and data contains the following hierarchy:

data/
  foo.txt
  img/
    a.png
    b.png

then AssetDir("data") would return []string{"foo.txt", "img"} AssetDir("data/img") would return []string{"a.png", "b.png"} AssetDir("foo.txt") and AssetDir("notexist") would return an error AssetDir("") will return []string{"data"}.

func AssetInfo

func AssetInfo(name string) (os.FileInfo, error)

AssetInfo loads and returns the asset info for the given name. It returns an error if the asset could not be found or could not be loaded.

func AssetNames

func AssetNames() []string

AssetNames returns the names of the assets.

func MustAsset

func MustAsset(name string) []byte

MustAsset is like Asset but panics when Asset would return an error. It simplifies safe initialization of global variables.

func RestoreAsset

func RestoreAsset(dir, name string) error

RestoreAsset restores an asset under the given directory

func RestoreAssets

func RestoreAssets(dir, name string) error

RestoreAssets restores an asset under the given directory recursively

Types

type AllowedFI

type AllowedFI struct {
	ID        int64     `db:"id"`
	Name      string    `db:"name"`
	Domain    string    `db:"domain"`
	PublicKey string    `db:"public_key"`
	AllowedAt time.Time `db:"allowed_at"`
}

AllowedFI represents allowed FI

type AllowedUser

type AllowedUser struct {
	ID          int64     `db:"id"`
	FiName      string    `db:"fi_name"`
	FiDomain    string    `db:"fi_domain"`
	FiPublicKey string    `db:"fi_public_key"`
	UserID      string    `db:"user_id"`
	AllowedAt   time.Time `db:"allowed_at"`
}

AllowedUser represents allowed user

type AuthData

type AuthData struct {
	ID        int64  `db:"id"`
	RequestID string `db:"request_id"`
	Domain    string `db:"domain"`
	AuthData  string `db:"auth_data"`
}

AuthData represents auth data

type AuthorizedTransaction

type AuthorizedTransaction struct {
	ID             int64     `db:"id"`
	TransactionID  string    `db:"transaction_id"`
	Memo           string    `db:"memo"`
	TransactionXdr string    `db:"transaction_xdr"`
	AuthorizedAt   time.Time `db:"authorized_at"`
	Data           string    `db:"data"`
}

AuthorizedTransaction represents authorized transaction

type Database

type Database interface {
	InsertAuthorizedTransaction(transaction *AuthorizedTransaction) error
	GetAuthorizedTransactionByMemo(memo string) (*AuthorizedTransaction, error)

	InsertAllowedFI(fi *AllowedFI) error
	GetAllowedFIByDomain(domain string) (*AllowedFI, error)
	DeleteAllowedFIByDomain(domain string) error

	InsertAllowedUser(user *AllowedUser) error
	GetAllowedUserByDomainAndUserID(domain, userID string) (*AllowedUser, error)
	DeleteAllowedUserByDomainAndUserID(domain, userID string) error

	InsertAuthData(authData *AuthData) error
	GetAuthData(requestID string) (*AuthData, error)
}

type PostgresDatabase

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

func (*PostgresDatabase) DeleteAllowedFIByDomain

func (d *PostgresDatabase) DeleteAllowedFIByDomain(domain string) error

DeleteAllowedFIByDomain deletes allowed FI by a domain

func (*PostgresDatabase) DeleteAllowedUserByDomainAndUserID

func (d *PostgresDatabase) DeleteAllowedUserByDomainAndUserID(domain, userID string) error

DeleteAllowedUserByDomainAndUserID deletes allowed user by domain and userID

func (*PostgresDatabase) GetAllowedFIByDomain

func (d *PostgresDatabase) GetAllowedFIByDomain(domain string) (*AllowedFI, error)

GetAllowedFIByDomain returns allowed FI by a domain

func (*PostgresDatabase) GetAllowedUserByDomainAndUserID

func (d *PostgresDatabase) GetAllowedUserByDomainAndUserID(domain, userID string) (*AllowedUser, error)

GetAllowedUserByDomainAndUserID returns allowed user by domain and userID

func (*PostgresDatabase) GetAuthData

func (d *PostgresDatabase) GetAuthData(requestID string) (*AuthData, error)

GetAuthData gets auth data by request ID

func (*PostgresDatabase) GetAuthorizedTransactionByMemo

func (d *PostgresDatabase) GetAuthorizedTransactionByMemo(memo string) (*AuthorizedTransaction, error)

GetAuthorizedTransactionByMemo returns authorized transaction searching by memo

func (*PostgresDatabase) GetDB

func (d *PostgresDatabase) GetDB() *sql.DB

func (*PostgresDatabase) InsertAllowedFI

func (d *PostgresDatabase) InsertAllowedFI(fi *AllowedFI) error

InsertAllowedFI inserts a new allowed FI into DB.

func (*PostgresDatabase) InsertAllowedUser

func (d *PostgresDatabase) InsertAllowedUser(user *AllowedUser) error

InsertAllowedUser inserts a new allowed user into DB.

func (*PostgresDatabase) InsertAuthData

func (d *PostgresDatabase) InsertAuthData(authData *AuthData) error

InsertAuthData inserts a new auth data into DB.

func (*PostgresDatabase) InsertAuthorizedTransaction

func (d *PostgresDatabase) InsertAuthorizedTransaction(transaction *AuthorizedTransaction) error

InsertAuthorizedTransaction inserts a new authorized transaction into DB.

func (*PostgresDatabase) Open

func (d *PostgresDatabase) Open(dsn string) error

Jump to

Keyboard shortcuts

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