Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: improve the documentation of the endpoints 📝 #13

Merged
merged 11 commits into from
Dec 28, 2024
11 changes: 8 additions & 3 deletions docs/swagger.json

Large diffs are not rendered by default.

355 changes: 297 additions & 58 deletions docs/swagger.yaml

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions internal/db/mysql.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func (p *mysqlProvider) CreateDB(dbName string) error {
}
return nil
}
func (p *mysqlProvider) GetTable(tableName string) ([]*models.TableInfoResp, error) {
func (p *mysqlProvider) GetTable(tableName string) ([]*models.TableColumnInfo, error) {
queryString := `
SELECT column_name AS name,
column_type AS type,
Expand All @@ -58,9 +58,9 @@ func (p *mysqlProvider) GetTable(tableName string) ([]*models.TableInfoResp, err
return nil, err
}
defer rows.Close()
tablesDescriptions := []*models.TableInfoResp{}
tablesDescriptions := []*models.TableColumnInfo{}
for rows.Next() {
tableDesc := new(models.TableInfoResp)
tableDesc := new(models.TableColumnInfo)
err := rows.StructScan(tableDesc)
if err != nil {
return nil, err
Expand Down
6 changes: 3 additions & 3 deletions internal/db/pg.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func (p *pgProvider) CreateDB(dbName string) error {
return nil
}

func (p *pgProvider) GetTable(tableName string) ([]*models.TableInfoResp, error) {
func (p *pgProvider) GetTable(tableName string) ([]*models.TableColumnInfo, error) {
queryString := `
SELECT col.column_name AS name,
col.data_type AS type,
Expand All @@ -61,9 +61,9 @@ func (p *pgProvider) GetTable(tableName string) ([]*models.TableInfoResp, error)
return nil, err
}
defer rows.Close()
tablesDescriptions := []*models.TableInfoResp{}
tablesDescriptions := []*models.TableColumnInfo{}
for rows.Next() {
tableDesc := new(models.TableInfoResp)
tableDesc := new(models.TableColumnInfo)
err := rows.StructScan(tableDesc)
if err != nil {
return nil, err
Expand Down
6 changes: 3 additions & 3 deletions internal/db/sqlite.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func (p *SqliteProvider) CreateDB(dbName string) error {
return errors.New("Unsupported")
}

func (p *SqliteProvider) GetTable(tableName string) ([]*models.TableInfoResp, error) {
func (p *SqliteProvider) GetTable(tableName string) ([]*models.TableColumnInfo, error) {
queryString := `
SELECT name,type,
CASE when 'notnull' = 1
Expand All @@ -63,9 +63,9 @@ func (p *SqliteProvider) GetTable(tableName string) ([]*models.TableInfoResp, er
return nil, err
}
defer rows.Close()
tablesDescriptions := []*models.TableInfoResp{}
tablesDescriptions := []*models.TableColumnInfo{}
for rows.Next() {
tableDesc := new(models.TableInfoResp)
tableDesc := new(models.TableColumnInfo)
err := rows.StructScan(tableDesc)
if err != nil {
return nil, err
Expand Down
2 changes: 1 addition & 1 deletion internal/db/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ type DatabaseExecuter interface {
// Interface that must be implemented by any
// storage driver dealing with table logic
type TableExecuter interface {
GetTable(tableName string) ([]*models.TableInfoResp, error)
GetTable(tableName string) ([]*models.TableColumnInfo, error)
ListTables() ([]*string, error)
CreateTable(tableName string, data []models.CreateTablePayload) error
DeleteTable(tableName string) error
Expand Down
Loading
Loading