cloudquery / cq-provider-sdk

CloudQuery Provider SDK enables building providers to query any service or custom in-house solutions with SQL
https://cloudquery.io
Mozilla Public License 2.0
8 stars 15 forks source link

path resovler for relations #432

Closed amanenk closed 2 years ago

amanenk commented 2 years ago

create a function that works as path resolver for columns but for relations.

instead of filling up a resolver with repeatable code like below

func fetchLightsailInstanceAddOns(ctx context.Context, meta schema.ClientMeta, parent *schema.Resource, res chan<- interface{}) error {
    instance := parent.Item.(types.Instance)
    res <- instance.AddOns
    return nil
}

That would be nice to just set a resovler

{
                Name:          "aws_lightsail_instance_add_ons",
                Description:   "Describes an add-on that is enabled for an Amazon Lightsail resource.",
                //Resolver:      fetchLightsailInstanceAddOns,
                Resolver:      schema.RelationPathResolver("AddOns"),
                IgnoreInTests: true,
                Columns: []schema.Column{
                ...