No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

doc.go 2.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. // Package configure 提供配置中心客户端的SDK,支持数据库字典的增删改查操作。
  2. //
  3. // 主要功能:
  4. // - 数据库表字典的创建、查询、更新、删除
  5. // - 支持Basic认证和Token认证
  6. // - 自动从全局配置加载配置中心地址和token
  7. // - 完整的错误处理和类型安全
  8. //
  9. // 快速开始:
  10. //
  11. // // 使用默认配置(从全局config获取)
  12. // client, err := configure.NewClient()
  13. // if err != nil {
  14. // log.Fatal(err)
  15. // }
  16. //
  17. // // 查询数据库表字典列表
  18. // query := &configure.DicTableQueryRequest{
  19. // QueryRequest: queryreq.QueryRequest{
  20. // Page: 0,
  21. // PageSize: 10,
  22. // },
  23. // }
  24. //
  25. // result, err := client.ListTables(context.Background(), query)
  26. // if err != nil {
  27. // log.Fatal(err)
  28. // }
  29. //
  30. // // 创建数据库表字典
  31. // req := &configure.DicTableRequest{
  32. // TableID: "test_table_001",
  33. // TableType: "实体表",
  34. // Name: "测试表",
  35. // Description: "测试表描述",
  36. // Fields: []configure.DicTableFieldRequest{
  37. // {
  38. // FieldID: "test_table_001.id",
  39. // TableID: "test_table_001",
  40. // FiledType: "实际字段",
  41. // DataType: "数值型",
  42. // FieldName: "id",
  43. // FieldNameCN: "主键ID",
  44. // Description: "主键字段",
  45. // },
  46. // },
  47. // }
  48. //
  49. // detail, err := client.SaveTable(context.Background(), req)
  50. // if err != nil {
  51. // log.Fatal(err)
  52. // }
  53. //
  54. // 配置说明:
  55. //
  56. // 客户端支持两种认证方式:
  57. // - Basic认证:使用用户名和密码
  58. // - Token认证:使用Bearer token
  59. //
  60. // 配置可以从以下方式获取:
  61. // - 全局配置:通过config.GetConfigureConfig()获取配置中心地址和token
  62. // - 自定义配置:通过NewClientWithConfig()传入自定义配置
  63. //
  64. // API端点:
  65. // - POST /api/dic-table/list - 查询数据库表字典列表
  66. // - POST /api/dic-table/detail/{table_id} - 查询数据库表字典详情
  67. // - POST /api/dic-table/save - 创建或更新数据库表字典
  68. // - POST /api/dic-table/delete/{table_id} - 删除数据库表字典
  69. package configure