Documentation ¶
Index ¶
- Variables
- func SetDefaultRepository(r Repository)
- type Record
- type Repository
- type ResolveInfoType
- type SqliteDbResolver
- func (r *SqliteDbResolver) Create(hash, publicKey, proof string, validations []string) (bool, error)
- func (r *SqliteDbResolver) Delete(hash string) (bool, error)
- func (r *SqliteDbResolver) Get(hash string) (*ResolveInfoType, error)
- func (r *SqliteDbResolver) SoftDelete(hash string) (bool, error)
- func (r *SqliteDbResolver) SoftUndelete(hash string) (bool, error)
- func (r *SqliteDbResolver) Update(info *ResolveInfoType, publicKey, proof string, validations []string) (bool, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNotFound = errors.New("record not found")
ErrNotFound will be returned when a record we are looking for is not found in the db
Functions ¶
func SetDefaultRepository ¶
func SetDefaultRepository(r Repository)
Sets the default repository for resolving. Can be used to override for mocking/testing purposes
Types ¶
type Record ¶
type Record struct { Hash string `dynamodbav:"hash"` PublicKey string `dynamodbav:"public_key"` Proof string `dynamodbav:"proof"` Validations []string `dynamodbav:"validations"` Serial uint64 `dynamodbav:"sn"` Deleted bool `dynamodbav:"deleted"` DeletedAt uint64 `dynamodbav:"deleted_at"` }
Record holds a DynamoDB record
type Repository ¶
type Repository interface { Get(hash string) (*ResolveInfoType, error) Create(hash, publicKey, proof string, validations []string) (bool, error) Update(info *ResolveInfoType, publicKey, proof string, validations []string) (bool, error) SoftDelete(hash string) (bool, error) SoftUndelete(hash string) (bool, error) Delete(hash string) (bool, error) }
Repository to resolve records
func GetResolveRepository ¶
func GetResolveRepository() Repository
GetResolveRepository returns a new repository based on DynamoDB
func NewBoltResolver ¶
func NewBoltResolver() Repository
NewBoltResolver returns a new resolver based on BoltDB
func NewDynamoDBResolver ¶
func NewDynamoDBResolver(client *dynamodb.DynamoDB, tableName string) Repository
NewDynamoDBResolver returns a new resolver based on DynamoDB
func NewSqliteResolver ¶
func NewSqliteResolver(dsn string) Repository
NewDynamoDBResolver returns a new resolver based on DynamoDB
type ResolveInfoType ¶
type ResolveInfoType struct { Hash string PubKey string Proof string Validations []string Serial uint64 Deleted bool DeletedAt time.Time }
ResolveInfoType returns information found in the resolver repository
type SqliteDbResolver ¶
func (*SqliteDbResolver) Create ¶
func (r *SqliteDbResolver) Create(hash, publicKey, proof string, validations []string) (bool, error)
func (*SqliteDbResolver) Get ¶
func (r *SqliteDbResolver) Get(hash string) (*ResolveInfoType, error)
func (*SqliteDbResolver) SoftDelete ¶ added in v0.2.0
func (r *SqliteDbResolver) SoftDelete(hash string) (bool, error)
func (*SqliteDbResolver) SoftUndelete ¶ added in v0.2.0
func (r *SqliteDbResolver) SoftUndelete(hash string) (bool, error)
func (*SqliteDbResolver) Update ¶
func (r *SqliteDbResolver) Update(info *ResolveInfoType, publicKey, proof string, validations []string) (bool, error)
Click to show internal directories.
Click to hide internal directories.