github.com/aacfactory/fns-contrib/databases/sql@v1.2.84/dac/specifications/table_test.go (about)

     1  package specifications_test
     2  
     3  import (
     4  	"fmt"
     5  	"github.com/aacfactory/fns-contrib/databases/sql/dac/specifications"
     6  	"testing"
     7  )
     8  
     9  type TableInfo struct {
    10  	name      string
    11  	schema    string
    12  	view      bool
    13  	conflicts []string
    14  }
    15  
    16  func (info TableInfo) Schema() string {
    17  	return info.schema
    18  }
    19  
    20  func (info TableInfo) Name() string {
    21  	return info.name
    22  }
    23  
    24  func (info TableInfo) View() bool {
    25  	return info.view
    26  }
    27  
    28  func (info TableInfo) Conflicts() []string {
    29  	return info.conflicts
    30  }
    31  
    32  type SomeTable struct {
    33  }
    34  
    35  func (t SomeTable) TableInfo() TableInfo {
    36  	return TableInfo{
    37  		name:      "name",
    38  		schema:    "schema",
    39  		view:      true,
    40  		conflicts: []string{"f1", "f2"},
    41  	}
    42  }
    43  
    44  func TestGetTableInfo(t *testing.T) {
    45  	info, infoErr := specifications.GetTableInfo(SomeTable{})
    46  	if infoErr != nil {
    47  		fmt.Println(fmt.Sprintf("%+v", infoErr))
    48  		return
    49  	}
    50  	fmt.Println(fmt.Sprintf("%+v", info))
    51  }