fogfish / dynamo Goto Github PK
View Code? Open in Web Editor NEWGeneric Golang Key/Value trait for AWS storage services
License: MIT License
Generic Golang Key/Value trait for AWS storage services
License: MIT License
The projection expression allows to limit number of columns. These columns are deductible from the type definition.
The following syntax does not protect api from mixing constrains of different types
type Constrain[T Thing] interface{}
It is required
type Constrain[T Thing] interface{ TypeOf(T) }
Identity function is implemented as
func (x *myType) Identity() (string, string) {
return curie.IRI(x.ID).String(), curie.IRI(x.Suffix).String()
}
String encoding preserves :
(e.g. u:abc
). It becomes difficult to handle as S3. S3 requires conversion of type to path (e.g. u/abc/
).
Earlier release used LastEvaluatedKey to build a sequence of elements. New version migrated to Slice. It complicates the pagination. Implement the concept of cursor to fix an issue.
Usage of dynamo.ID
is an approach to label a struct. However, it brings few practical issues:
dynamodb.AttributeValue
typeConsider a following scenario:
type A struct {
ID curie.IRI `dynamodbav:"-"`
Name string `dynamodbav:"name,omitempty"`
}
type dbA struct { A }
func (x dbA) MarshalDynamoDBAttributeValue(av *dynamodb.AttributeValue) error {
return someHelperFunction(x.A.ID, x)
}
func (x dbA) UnmarshalDynamoDBAttributeValue(av *dynamodb.AttributeValue) error {
return someHelperFunction(&x.A.ID, &x)
}
This approach still do not address an issue of linked data
type A struct {
ID curie.IRI
Link *curie.IRI
}
Put
{
"a": "test",
"list": [{"id":1, "text": "a"}, {"id":2, "text": "b"}, {"id":3, "text": "c"}, {"id":4, "text": "d"}]
}
{
"a": "test",
"list": [{"id":5, "text": "e"}, {"id":6, "text": "f"}]
}
after the update, elements of struct at list
is corrupted.
aws dynamodb query \
--table-name earth-catalog \
--key-condition-expression "prefix = :prefix and suffix between :suffix1 and :suffix2" \
--expression-attribute-values '{":prefix":{"S":"article:fogfish"}, ":suffix1":{"S":"0001"}, ":suffix2":{"S":"0002"} }'
// FMap transforms sequence
func (seq *dbSeq) FMap(f func(Gen) error) error {
for seq.Tail() {
if err := f(seq.slice.Head()); err != nil {
return err
}
}
return nil
}
return nil if seq.Tail()
seeding fails with an error
ValidationException: One or more parameter values are not valid. The AttributeValue for a key attribute cannot contain an empty string value. Key: prefix
dynamo.Decode
does not handle error gracefully
https://github.com/fogfish/dynamo/blob/main/id.go#L146
Allow user to pass the hash key sort key as config values.
See official doc for details https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/HowItWorks.ReadConsistency.html
Existing library interface tries to mimic a general purpose dynamo io. However, it is only designed to support adj. list pattern. It benefits if API emphasis this facts.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.