Giter VIP home page Giter VIP logo

dynamo's Issues

Constrain is not a type safe

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) }

Incompatibility of Identity

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/).

Fix pagination at Match using LastEvaluatedKey

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.

Use Marshall / Unmarshall codes for structs

Usage of dynamo.ID is an approach to label a struct. However, it brings few practical issues:

  1. It creates deps between core types and aws sdk due to dynamodb.AttributeValue type
  2. Usage of type composition does not make an explicit mapping of core ID to dynamo ID

Consider 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
}

S3 update corrupts the struct

  1. Put the document to s3 using Put
{
   "a": "test",
   "list": [{"id":1, "text": "a"}, {"id":2, "text": "b"}, {"id":3, "text": "c"}, {"id":4, "text": "d"}]
}
  1. Update the document at s3
{
   "a": "test",
   "list": [{"id":5, "text": "e"}, {"id":6, "text": "f"}]
}

after the update, elements of struct at list is corrupted.

Support `between` statement

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 returns nil error

// 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

Can't use Put for dynamodb

ValidationException: One or more parameter values are not valid. The AttributeValue for a key attribute cannot contain an empty string value. Key: prefix

Focus the library on supporting adj. lists

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.

  • Thing interface to explicitly support Partition / SortKey
  • Stream interface is a file-system interface
  • Helper methods to deal with I/O errors, especially NotFound one.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.