https://github.com/helloticket/ffparser
The library is a Flat-File Parser
https://github.com/helloticket/ffparser
files flat-file golang
Last synced: over 1 year ago
JSON representation
The library is a Flat-File Parser
- Host: GitHub
- URL: https://github.com/helloticket/ffparser
- Owner: helloticket
- License: mit
- Created: 2017-04-27T03:38:46.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2022-09-05T17:27:39.000Z (almost 4 years ago)
- Last Synced: 2025-01-21T06:25:49.789Z (over 1 year ago)
- Topics: files, flat-file, golang
- Language: Go
- Size: 121 KB
- Stars: 1
- Watchers: 8
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ffparser
The library is a Flat-File Parser
## Install
```bash
go get -v github.com/helloticket/ffparser
```
## Using
```go
package main
import (
"log"
"time"
"github.com/helloticket/ffparser"
)
type Pojo struct {
Value1 time.Time `record:"start=1,end=21"`
Value2 int `record:"start=22,end=32"`
Value3 int64 `record:"start=33,end=43"`
Value4 float64 `record:"start=44,end=54"`
Value5 string `record:"start=55,end=65"`
}
func main() {
ffp := ffparser.NewSimpleParser()
result, _ := ffp.ParseToText(&Pojo{
Value1: time.Date(2017, 5, 10, 0, 0, 0, 0, time.UTC),
Value2: 12402,
Value3: 4567822222,
Value4: 4567833.22,
Value5: "be happy",
})
log.Println(result)
}
```
## Inspired
https://github.com/ffpojo/ffpojo