InfluxCommunity / influxdb3-go

The go package that provides a simple and convenient way to interact with InfluxDB 3.
https://pkg.go.dev/github.com/InfluxCommunity/influxdb3-go
MIT License
21 stars 11 forks source link

Point: more intuitive method for casting Point to lineprotocol string #58

Open karel-rehor opened 5 months ago

karel-rehor commented 5 months ago

Use Case

In testing and inspection it's often handy to get a lineprotocol representation of how a Point will be written to Influxdb. This currently can be done by creating a string from the results of the method MarshalBinary. However this is not a friendly or intuitive solution.

Expected behavior

A method with a name like ToLineprotocol would be more intuitive.
e.g.

func (p *Point) ToLineprotocol() string {
    binArr, err := p.MarshalBinary(lineprotocol.Millisecond)
    if err != nil {
        panic(err)
    }
    return string(binArr)
}

Actual behavior

Currently I need to write a similar function in a local project, though ideally it should be a method for the Point type.

Additional info

No response