bminer / schemer Goto Github PK
View Code? Open in Web Editor NEWLightweight and flexible data encoding and decoding library
License: MIT License
Lightweight and flexible data encoding and decoding library
License: MIT License
This will fix a majority of golint
issues
Make a new .GO module called "tag-options_test.go" which contains a test to make sure that Schemer can parse struct tags properly. Have the test include all variations of tags.
It doesn't appear possible to decode structures into empty interfaces. This might be related to the fact that DefaultGOType() for FixedObjects does not return an appropriate structure. (It currently only returns a blank struct.)
bits
and length
fields should be allowed to be null
name
should be allowed to be a string or an array of strings (currently only array of strings works)There is enough room for 64 custom schema IDs. Probably have 0-31 be well-defined types and 32-63 be custom user-defined types
Replace DecodeSchema
and DecodeSchemaJSON
with something like NewSchemaDecoder
and NewJSONSchemaDecoder
.
I'd like to mirror the JSON decoder API to provide a Buffered()
method that returns an io.Reader
.
This makes it clearer that the io.Reader
is a buffered reader, and it exposes the buffered but unconsumed contents of the Reader.
It might be a good idea to include some binary schemas and encoded data to use during unit testing. The binary data should be generated by encoding data with Schemer.
Then during unit tests, where changes could potentially be made to encoding / decoding logic, it is important to check the behavior of both the encoding and decoding logic.
On the encoding side, the tests should compare binary data generated with know good binary data.
On the decoding side, the test should make sure the decoder can always decode the known binary data to known values.
Adding the version number of schemer itself to the encoded schemas will allow even more compatibility as schemer evolves
ParseStructTag() in module tag-options currently uses an ad hoc method to parse the schemer tags on structures. A better approach is to utilize regular expressions to parse the tags.
The syntax of the tags should be checked. Currently I believe they are in the format like this:
tag := (alias)?("," option)*
alias := identifier
"["identifier(","identifier)*"]"
option := "weak", "null", "not null"
An example tag is:
schemer:"readings"
The example programs in the examples directory need finished. Having good examples is important because they illustrate how to use the library, and show why Schemer is useful in a concrete way. Therefore, having them could be helpful to programmers considering using Schemer.
Perhaps built-in Schema implementations can re-use buffers internally to reduce memory allocations for each Decode
call?
A major use case for this library is probably to communicate from a GO server to Browser UI. Therefore, having a java script implementation seems important and worth implementing.
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.