• Stars
    star
    16
  • Rank 1,267,507 (Top 26 %)
  • Language
    Go
  • License
    MIT License
  • Created over 7 years ago
  • Updated about 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

➿ Serialize any custom type or convert any content to []byte or string, for Go Programming Language


Build Status

Awesome GoLang

Report A+

License

Releases

Godoc

Chat



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.

More Repositories

1

iris

The fastest HTTP/2 Go Web Framework. New, modern and easy to learn. Fast development with Code you control. Unbeatable cost-performance ratio 🚀
Go
24,712
star
2

neffos

A modern, fast and scalable websocket framework with elegant API written in Go
Go
559
star
3

golog

A high-performant Logging Foundation for Go Applications. X3 faster than the rest leveled loggers.
Go
317
star
4

muxie

Muxie is a modern, fast and light HTTP multiplexer for Go. Fully compatible with the http.Handler interface. Written for everyone.
Go
282
star
5

go-sessions

🔐 The sessions manager for the Go Programming Language. Supports both net/http and fasthttp.
Go
204
star
6

rizla

👀 Rizla builds, runs and monitors your Go Applications with ease. See https://github.com/kataras/iris-cli for Iris users.
Go
190
star
7

jwt

A fast and simple JWT implementation for Go
Go
189
star
8

iris-cli

[WIP] Iris Command Line Interface
Go
117
star
9

i18n

🆕 High-performant and powerful localization and internationalization support for Go
Go
103
star
10

go-events

📣 Pure nodejs EventEmmiter for the Go Programming Language.
Go
95
star
11

server-benchmarks

🚀 Cross-platform transparent benchmarks for HTTP/2 Web Servers at 2020-2023
Go
85
star
12

blocks

Go-idiomatic View Engine
Go
69
star
13

go-websocket

🔈 Deprecated. Use https://github.com/kataras/neffos instead
Go
59
star
14

go-template

🔈 Deprecated. Use https://github.com/kataras/iris/wiki/View instead
Go
56
star
15

versioning

🆕 API Versioning for Go
Go
50
star
16

build-a-better-web-together

Deprecated. Moved to https://github.com/kataras/iris/wiki and https://docs.iris-go.com
CSS
48
star
17

httpcache

ABANDONED: Use https://github.com/kataras/iris instead. Extremely-easy cache service for HTTP/x . Supports both net/http and valyala/fasthttp
Go
43
star
18

neffos.js

Node.js and Browser support for the neffos real-time framework written in Typescript.
TypeScript
39
star
19

hcaptcha

hCaptcha HTTP middleware for Go web servers
Go
32
star
20

pg

PG is a Go library that simplifies PostgreSQL database interaction with struct-based entities, schema management, and repository pattern.
Go
27
star
21

tunnel

Public URLs for exposing your local web server
Go
26
star
22

go-fs

📁 Provides some common utilities which GoLang developers use when working with files, either system files or web files.
Go
26
star
23

rewrite

The rewrite middleware for Go. Perfect for SEO
Go
22
star
24

pio

Low-level package that provides an easy way to centralize different output targets. Supports colors and text decoration to all popular terminals
Go
20
star
25

httpfs

Flexible and easy to use HTTP File Server for Go
Go
19
star
26

sitemap

🆕 Sitemap Protocol for Go | https://support.google.com/webmasters/answer/189077?hl=en
Go
19
star
27

go-errors

⚠️ Better GoLang error handling.
Go
18
star
28

compress

HTTP Compression for Go
Go
16
star
29

chronos

NEW: Chronos provides an easy way to limit X operations per Y time in accuracy of nanoseconds
Go
14
star
30

basicauth

The most advanced and powerful Go HTTP Basic Authentication middleware.
Go
13
star
31

gitbook-to-wiki

Export your GitBook as a GitHub Wiki or Docsify pages.
Go
13
star
32

sheets

📊 (Unofficial) A Lightweight Google Spreadsheets Client written in Go
Go
12
star
33

vscode-iris

Iris Web Framework snippets for Visual Studio Code
TypeScript
9
star
34

realip

Extract the real HTTP client's Remote IP Address
Go
8
star
35

methodoverride

🆕 Lets you use HTTP verbs such as PUT or DELETE in places where the client doesn't support it
Go
7
star
36

trie-examples-to-remember-again

A place to keep my coding examples for different kind of trie usage in order to remember them again - this time on github
Go
7
star
37

requestid

Unique Identifier for each HTTP request
Go
6
star
38

go-options

📦 Clean APIs for your Go Applications
Go
5
star
39

httpclient

HTTP/2 Client for Go Programming Language #golang #http
Go
4
star
40

mail

Mail is a ridiculous simple email sender written in Go
Go
4
star
41

pkg

Public Repository of the common packages that Gerasimos Maropoulos, the author of Iris, uses for various commercial or non-commercial projects.
Go
4
star
42

pgx-golog

pgx and golog integration
Go
3
star
43

kataras

Gerasimos Maropoulos
1
star