gocal | ICS file parser in Golang

 by   apognu Go Version: Current License: MIT

kandi X-RAY | gocal Summary

kandi X-RAY | gocal Summary

gocal is a Go library. gocal has no bugs, it has no vulnerabilities, it has a Permissive License and it has low support. You can download it from GitHub.

Fast (and opinionated) ICAL parser in Golang. Gocal takes an io.Reader and produces an array of Events from it. Event are parsed between two given dates (Gocal.Start and Gocal.End, 3 months by default). Any event outside this range will be ignored. This behavior can be disabled by setting SkipBounds to true in the Gocal struct. Please note that the behavior will still be enacted for recurring event, to prevent infinite parsing.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              gocal has a low active ecosystem.
              It has 35 star(s) with 10 fork(s). There are 2 watchers for this library.
              OutlinedDot
              It had no major release in the last 6 months.
              There are 1 open issues and 8 have been closed. On average issues are closed in 65 days. There are 4 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of gocal is current.

            kandi-Quality Quality

              gocal has 0 bugs and 0 code smells.

            kandi-Security Security

              gocal has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              gocal code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              gocal is licensed under the MIT License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              gocal releases are not available. You will need to build from source code and install.
              Installation instructions are not available. Examples and code snippets are available.
              It has 1390 lines of code, 47 functions and 13 files.
              It has high code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi has reviewed gocal and discovered the below as its top functions. This is intended to give you an instant insight into gocal implemented functionality, and help decide if they suit your requirements.
            • parseEvent handles an event
            • ParseTime - parses string to time . Time
            • parseDayNameToIcsName converts a day name to ics name .
            • LoadTimezone loads timezone from tzid
            • ParseGeo returns the latitude and longitude longitude .
            • Example for example
            • ParseRecurrenceParams parses a sequence of params
            • ParseParameters takes a string and returns a map of parameters
            • NewParser returns Gocal instance
            • ParseDuration is like ParseDuration .
            Get all kandi verified functions for this library.

            gocal Key Features

            No Key Features are available at this moment for gocal.

            gocal Examples and Code Snippets

            No Code Snippets are available at this moment for gocal.

            Community Discussions

            QUESTION

            How to save, and then serve again data of type io.Reader?
            Asked 2021-Aug-14 at 16:33

            I would like to parse several times with gocal data I retrieve through a HTTP call. Since I would like to avoid making the call for each of the parsing, I would like to save this data and reuse it.

            The Body I get from http.Get is of type io.ReadCloser. The gocal parser requires io.Reader so it works.

            Since I can retrieve Body only once, I can save it with body, _ := io.ReadAll(get.Body) but then I do not know how to serve []byte as io.Reader back (to the gocal parser, several times to account for different parsing conditions)

            ...

            ANSWER

            Answered 2021-Aug-14 at 16:33

            As you have figured, the http.Response.Body is exposed as an io.Reader, this reader is not re usable because it is connected straight to the underlying connection* (might be tcp/utp/or any other stream like reader under the net package). Once you read the bytes out of the connection, new bytes are sitting their waiting for another read.

            In order to save the response, indeed, you need to drain it first, and save that result within a variable.

            body, _ := io.ReadAll(get.Body)

            To re use that slice of bytes many time using the Go programming language, the standard API provides a buffered reader bytes.NewReader.

            This buffer adequately offers the Reset([]byte) method to reset the state of the buffer.

            The bytes.Reader.Reset is very useful to read multiple times the same bytes buffer with no allocations. In comparison, bytes.NewReader allocates every time it is called.

            Finally, between two consecutive calls to c.Parser, you should reset the buffer with bytes buffer you have collected previously.

            such as :

            Source https://stackoverflow.com/questions/68784480

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install gocal

            You can download it from GitHub.

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/apognu/gocal.git

          • CLI

            gh repo clone apognu/gocal

          • sshUrl

            git@github.com:apognu/gocal.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link