spec.go 947 B

12345678910111213141516171819202122232425262728293031323334
  1. package sdk
  2. import "github.com/fatih/structs"
  3. type DataContainerDatabaseSpec struct {
  4. TableName string `structs:"table_name"`
  5. Columns []DataContainerDatabaseColumnSpec `structs:"columns"`
  6. }
  7. type DataContainerDatabaseColumnSpec struct {
  8. Name string `structs:"name"`
  9. Type string `structs:"type"`
  10. Comment string `structs:"comment"`
  11. PrimaryKey bool `structs:"primary_key"`
  12. Size int `structs:"size"`
  13. Unique bool `structs:"unique"`
  14. NotNull bool `structs:"not_null"`
  15. Index bool `structs:"index"`
  16. UniqueIndex string `structs:"unique_index"`
  17. Default any `structs:"default"`
  18. }
  19. func (spec *DataContainerDatabaseSpec) ToMap() map[string]any {
  20. return structs.Map(spec)
  21. }
  22. type SqlSpec struct {
  23. Transaction bool `structs:"transaction"`
  24. Clauses string `structs:"clauses"`
  25. }
  26. func (spec *SqlSpec) ToMap() map[string]any {
  27. return structs.Map(spec)
  28. }