Skip to content

Add an independent parameter to control whether columns are sortable. #619

@shellwalker

Description

@shellwalker

If parameter format.sort is set to true , tables, columns, relations, constraints, and viewpoints will all be sorted by Name after Schema.Sort is called.

After execute the command tbls doc, it will generate an index file which named README.md in output directory doc/schema, the order of table, relations... keep the consistency, it looks good for me.

But for the columns' order in each table file(e.g., table-A.md), I still want to keep the default creation order instead of sorting them by name.

func (s *Schema) Sort() error {
...

  // if ( newSortFlag ) {
  sort.SliceStable(t.Columns, func(i, j int) bool {
			  return t.Columns[i].Name < t.Columns[j].Name
		  })
  // }
...
}

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions