Popularity
1.5
Declining
Activity
0.0
Stable
14
1
2

Programming language: Go
License: MIT License
Tags: Serialization     Go-capnproto    

go-serializer alternatives and similar packages

Based on the "go-capnproto" category.
Alternatively, view go-serializer alternatives based on common mentions on social networks and blogs.

Do you think we are missing an alternative of go-serializer or a related project?

Add another 'go-capnproto' Package

README

Serialize any custom type to []byte or string. Your custom serializers are, finally, organised.

Easy-to-use

While providing robust set of features, simple to understand.

Built'n supported serializers:

Go here to learn how you can create and use your own custom Serializer.

This package is already used by Iris web framework and Q web framework, examples here.

Installation

The only requirement is the Go Programming Language, at least v1.6.

$ go get -u github.com/kataras/go-serializer

Usage

package main

import (
  "github.com/kataras/go-serializer"
  "github.com/kataras/go-serializer/markdown"
)

func main() {
  markdownSerializer := markdown.New()

  serializer.For("markdown", markdownSerializer)

  result, err := serializer.SerializeToString("markdown", "## Hello")
  // Optional third parameter is a map[string]interface{}, which is any runtime options for the serializers registered to 'markdown' key

  println(result)
}

explanation

Create your own serializer or use one of the project's built'n serializers, in this case we will use the markdown serializer will receive markdown content as string and return the HTML form of them

markdownSerializer := markdown.New()

Learn how to create your own custom serializer go to the serializer_test.go, it's just one function.

mySerializers := serializer.Serializers{}
mySerializers.For("key", markdownSerializer)

Add the serializer to a custom key, using the default Serializers{}. It supports more than one serializer for each key

serializer.For("markdown", markdownSerializer)

Serialize something with the registered serializers by a key. If more than one Serializer is registered to the same key then the final result will be the results of all of its(key's) serializers

result, err := serializer.SerializeToString("markdown", "## Hello")

.Serialize(...) returns []byte, SerializeToString(...) returns string, they're the same use that you need

Print the result, will be just a <h2>Hello</h2>

println(result)

For more, please read each of the Serializers you want to use, built'n supported are:

You can also navigate to the godocs.

FAQ

If you'd like to discuss this package, or ask questions about it, feel free to

Versioning

Current: v0.0.5

Read more about Semantic Versioning 2.0.0

People

The author of go-serializer is @kataras.

Contributing

If you are interested in contributing to the go-serializer project and add more serializers, please make a PR.

License

This project is licensed under the MIT License.

License can be found [here](LICENSE).


*Note that all licence references and agreements mentioned in the go-serializer README section above are relevant to that project's source code only.