Socket
Socket
Sign inDemoInstall

git.fractalqb.de/fractalqb/daq

Package Overview
Dependencies
1
Alerts
File Explorer

Install Socket

Detect and block malicious and high-risk dependencies

Install

    git.fractalqb.de/fractalqb/daq

Access nested properties in Go data structures with Data Queries A query Result is a tuple (result value:any, missed steps:int), if missed steps is 0, the query was successful and the result is OK. Use “assert functions” or “fallback functions” to easily extract an expected type from a query result. Both are based on “convert functions”. The convert function for target type T is func(v any) (r T, err error). If conversion of v fails, err != nil and r is T's zero value. Otherwise, r is the conversion result. Use As to create an assertion function from a convert function. Use Fallback to create a fallback function from a convert function. By convention, convert functions for target type <T> are named To<T>(). Predefined assert functions are named As<T>(), predefined fallback functions <T>Or(). Use Get as the general way to perform queries. Read on to find more specific and efficient ways to query: Index, Field, Key to step with int, string and any. Further SliceAny, DictAny, MapAny to get query results that can be asserted from typical generic Go data. To extend daq to your own types write convert functions and familiarize with Stepper, Slice, Dict and Map. Signed and unsigned integer types are promoted to each other as long as the actual runtime value is in target type's range. Float values are promoted to integer types if the actual float has no fraction, and it is in target type's range. Complex values with imag()==0 are promoted to integer by promoting the real() part according to the float rules.


Version published

Readme

Source

daq

DAta Queries: Access nested properties in Go data structures.

FAQs

Last updated on 29 Dec 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc