Skip to content

Commit

Permalink
fix link in readme (#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
yuanbohan authored Feb 7, 2024
1 parent ddd87b4 commit e963b15
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,10 @@ stream, err := client.NewStreamClient(cfg)

#### Insert & StreamInsert

- you can Insert data into GreptimeDB via:
- [define schema](#with-schema-predefined)
- [define struct](#with-struct-tag)
- you can Insert data into GreptimeDB via different style:
- [Table/Column/Row style](#with-schema-predefined)
- [ORM style](#with-struct-tag)

- streaming insert is to Send data into GreptimeDB without waiting for response.

##### Datatypes supported
Expand Down Expand Up @@ -91,6 +92,8 @@ NOTE: Int is for all of Integer and Unsigned Integer in Go

##### With Schema predefined

you can define schema via Table and Column, and then AddRow to include the real data you want to write.

###### define table schema, and add rows

```go
Expand Down Expand Up @@ -119,14 +122,17 @@ err := streamClient.Send(context.Background(), tbl)

##### With Struct Tag

If you prefer ORM style, and define column-field relationship via struct field tag, you can try the following way.

###### Tag

- `greptime` is the tag key
- `tag`, `field`, `timestamp` is for [SemanticType][data-model]
- `greptime` is the struct tag key
- `tag`, `field`, `timestamp` is for [SemanticType][data-model], and the value is ignored
- `column` is to define the column name
- `type` is to define the data type. if type is timestamp, `precision` is supported
- the metadata separator is `;`, and the key value separator is `:`

type supported is the same as described [Datatypes supported in GreptimeDB](#greptimedb), and case insensitive.
type supported is the same as described [Datatypes supported](#datatypes-supported), and case insensitive

###### define struct with tags

Expand All @@ -138,8 +144,6 @@ type Monitor struct {
}

// TableName is to define the table name.
// if TableName method is not found, the snake style and lower case of struct name
// will be used as table name. The table name is `monitor` if TableName method not found.
func (Monitor) TableName() string {
return "<table_name>"
}
Expand Down

0 comments on commit e963b15

Please sign in to comment.