GithubHelp home page GithubHelp logo

Comments (3)

tihomir-kit avatar tihomir-kit commented on May 19, 2024

Hi,

yes, I didn't have the time yet to rework the docs (up until a few days ago I was mostly into refactoring only as I forked the library only very recently). I would assume you're using the nuget version are you, and not this latest dev version?

For the NuGet version (2.0.2), this is essentially how I do it currently in the project where I use the library (I have this scattered through a few wrapper functions of course, but this part of the code is relevant to you):

var influxDbClient = new InfluxDb(_influxDbUri, _influxDbUserName, _influxDbPassword, InfluxVersion.v095);

var point = BuildReadingPoint(someReadingDto);
var points = someReadingsDtoList.Select(p => BuildReadingPoint(p));

// in 2.0.2 there are two overloads for writing data, so you can use whatever you need
var pointResult = await influxDbClient.WriteAsync("SomeDbName", point);
var pointsResult = await influxDbClient.WriteAsync("SomeDbName", points);

Where BuildReadingPoint is something like this:

public Point BuildReadingPoint(ReadingMessageDTO dto)
{
    return new Point()
    {
        Name = "reading",
        Tags = new Dictionary<string, object>()
        {
            { "SensorId", dto.SensorId },
            { "SerialNumber", dto.SerialNumber }
        },
        Fields = new Dictionary<string, object>()
        {
            { "RawMessage", dto.RawMessage },
            { "Humidity", dto.Humidity },
            { "Temperature", dto.Temperature },
            { "Resistance", dto.Resistance }
        },
        Timestamp = dto.DateCreated
    };
}

I'll most probably update the library this weekend (it will have a few small breaking changes, but nothing much, should be very easy to update). And then I'll also prepare the docs to go with that as well.

Let me know if that worked for you, and if you need any additional help, feel free to ask. :)

from influxdata.net.

arobinsongit avatar arobinsongit commented on May 19, 2024

Great, thanks! I'm using it with the points method and it works really well. I'll be posting a video soon showing a cool store/forward feature I have in my app I'm building. May be something you would want to build into the library. I think you could make a solid debate either way though.

from influxdata.net.

tihomir-kit avatar tihomir-kit commented on May 19, 2024

No problem, I'm glad it works well. :)

Sure, when it's ready, open a new issue and explain what you mean by this, you can link your video also. Perhaps provide a short code sample of what you would like it to do as well.

from influxdata.net.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.