Skip to content

Commit 9464624

Browse files
committed
Update README.md
1 parent 7ebe384 commit 9464624

1 file changed

Lines changed: 69 additions & 0 deletions

File tree

README.md

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,75 @@
11
# interfaces [![GoDoc](https://godoc.org/github.com/rjeczalik/interfaces?status.png)](https://godoc.org/github.com/rjeczalik/interfaces) [![Build Status](https://img.shields.io/travis/rjeczalik/interfaces/master.svg)](https://travis-ci.org/rjeczalik/interfaces "linux_amd64") [![Build status](https://img.shields.io/appveyor/ci/rjeczalik/interfaces.svg)](https://ci.appveyor.com/project/rjeczalik/interfaces "windows_amd64")
22
Code generation tools for Go's interfaces.
33

4+
### cmd/structer [![GoDoc](https://godoc.org/github.com/rjeczalik/interfaces/cmd/structer?status.png)](https://godoc.org/github.com/rjeczalik/interfaces/cmd/structer)
5+
6+
Generates a struct for a formatted file. Currently supported formats are:
7+
8+
- CSV
9+
10+
*Usage*
11+
12+
```
13+
~ $ structer -help
14+
```
15+
```
16+
Usage of structer:
17+
-as string
18+
Generated struct name. (default "main.Struct")
19+
-f string
20+
Input file. (default "-")
21+
-o string
22+
Output file. (default "-")
23+
-tag string
24+
Name for a struct tag to add to each field.
25+
-type string
26+
Type of the input, overwrites inferred from file name.
27+
```
28+
29+
*Example*
30+
31+
```
32+
~ $ head -2 aws-billing.csv # first line is a CSV header, second - first line of values
33+
```
34+
```
35+
"InvoiceID","PayerAccountId","LinkedAccountId","RecordType","RecordId","ProductName","RateId","SubscriptionId","PricingPlanId","UsageType","Operation","AvailabilityZone","ReservedInstance","ItemDescription","UsageStartDate","UsageEndDate","UsageQuantity","BlendedRate","BlendedCost","UnBlendedRate","UnBlendedCost","ResourceId"
36+
"Estimated","54321","54321","LineItem","543212345","AWS CloudTrail","12345","12345","12345","USE1-FreeEventsRecorded","None","","N","0.0 per free event recorded in US East (N.Virginia) region","2016-01-01 00:00:00","2016-01-01 01:00:00","4105.00000000","0.0000000000","0.00000000","0.0000000000","0.00000000",""
37+
```
38+
```
39+
$ structer -f aws-billing.csv -tag json -as billing.Record
40+
```
41+
```
42+
// Created by structer; DO NOT EDIT
43+
44+
package billing
45+
46+
// Record is an struct generated from "aws-billing.csv" file.
47+
type Record struct {
48+
InvoiceID string `json:"invoiceID"`
49+
PayerAccountID int64 `json:"payerAccountID"`
50+
LinkedAccountID int64 `json:"linkedAccountID"`
51+
RecordType string `json:"recordType"`
52+
RecordID float64 `json:"recordID"`
53+
ProductName string `json:"productName"`
54+
RateID int64 `json:"rateID"`
55+
SubscriptionID int64 `json:"subscriptionID"`
56+
PricingPlanID int64 `json:"pricingPlanID"`
57+
UsageType string `json:"usageType"`
58+
Operation string `json:"operation"`
59+
AvailabilityZone string `json:"availabilityZone"`
60+
ReservedInstance string `json:"reservedInstance"`
61+
ItemDescription string `json:"itemDescription"`
62+
UsageStartDate string `json:"usageStartDate"`
63+
UsageEndDate string `json:"usageEndDate"`
64+
UsageQuantity float64 `json:"usageQuantity"`
65+
BlendedRate float64 `json:"blendedRate"`
66+
BlendedCost float64 `json:"blendedCost"`
67+
UnBlendedRate float64 `json:"unBlendedRate"`
68+
UnBlendedCost float64 `json:"unBlendedCost"`
69+
ResourceID string `json:"resourceID"`
70+
}
71+
```
72+
473
### cmd/interfacer [![GoDoc](https://godoc.org/github.com/rjeczalik/interfaces/cmd/interfacer?status.png)](https://godoc.org/github.com/rjeczalik/interfaces/cmd/interfacer)
574

675
Generates an interface for a named type.

0 commit comments

Comments
 (0)