github.com/selefra/selefra-provider-sdk@v0.0.23/provider/transformer/column_value_extractor/examples/column_value_extractor_parent_primary_keys_id/main.go (about)

     1  package main
     2  
     3  import (
     4  	"github.com/selefra/selefra-provider-sdk/provider/schema"
     5  	"github.com/selefra/selefra-provider-sdk/provider/transformer/column_value_extractor"
     6  )
     7  
     8  func main() {
     9  
    10  	exampleTable := &schema.Table{
    11  		TableName: "example_parent_table",
    12  		Options: &schema.TableOptions{
    13  			PrimaryKeys: []string{
    14  				"region",
    15  				"name",
    16  			},
    17  		},
    18  		Columns: []*schema.Column{
    19  			{
    20  				ColumnName: "region",
    21  				Type:       schema.ColumnTypeString,
    22  			},
    23  			{
    24  				ColumnName: "name",
    25  				Type:       schema.ColumnTypeString,
    26  			},
    27  			{
    28  				ColumnName: "id",
    29  				Type:       schema.ColumnTypeString,
    30  				Extractor:  column_value_extractor.ColumnsValueMd5("region", "name"),
    31  			},
    32  		},
    33  		SubTables: []*schema.Table{
    34  			{
    35  				TableName: "example_child_table",
    36  				Columns: []*schema.Column{
    37  					{
    38  						ColumnName: "parent_pk_id",
    39  						Type:       schema.ColumnTypeString,
    40  						Extractor:  column_value_extractor.ParentPrimaryKeysID(),
    41  					},
    42  				},
    43  			},
    44  		},
    45  	}
    46  	_ = exampleTable
    47  }