From 4f9b8a29daf5a4634beddcaded0c9db106a60d40 Mon Sep 17 00:00:00 2001 From: Zexi Li Date: Fri, 14 Aug 2020 17:02:54 +0800 Subject: [PATCH] fix: json TAG_PREFIX invalid syntax --- go.mod | 6 +- go.sum | 14 ++-- pkg/apis/cloudcommon/proxy/proxy.go | 2 +- pkg/apis/compute/api.go | 4 +- pkg/apis/compute/cachedloadbalanceracl.go | 2 +- .../compute/cachedloadbalancercertificate.go | 2 +- pkg/apis/compute/cloudaccount.go | 6 +- pkg/apis/compute/cloudprovider.go | 12 +-- pkg/apis/compute/dbinstance.go | 4 +- pkg/apis/compute/disk.go | 10 +-- pkg/apis/compute/elasticcache.go | 2 +- pkg/apis/compute/geo_input.go | 8 +- pkg/apis/compute/globalvpc.go | 2 +- pkg/apis/compute/guests.go | 12 +-- pkg/apis/compute/host.go | 2 +- pkg/apis/compute/hostjoin.go | 2 +- pkg/apis/compute/input.go | 2 +- pkg/apis/compute/instance_group.go | 2 +- pkg/apis/compute/loadbalancer.go | 2 +- pkg/apis/compute/loadbalancerbackendgroup.go | 2 +- pkg/apis/compute/loadbalancercluster.go | 2 +- pkg/apis/compute/loadbalancerlistener.go | 2 +- pkg/apis/compute/natgateway.go | 2 +- pkg/apis/compute/network.go | 4 +- pkg/apis/compute/schedtag.go | 4 +- pkg/apis/compute/secgroup.go | 2 +- pkg/apis/compute/storage_const.go | 2 +- pkg/apis/compute/storagecachedimage.go | 4 +- pkg/apis/compute/vpc.go | 2 +- pkg/apis/identity/identityprovider.go | 2 +- pkg/apis/identity/input.go | 18 ++--- pkg/apis/input.go | 12 +-- pkg/apis/list.go | 4 +- pkg/apis/output.go | 4 +- pkg/apis/yunionconf/input.go | 4 +- vendor/modules.txt | 6 +- vendor/yunion.io/x/jsonutils/.gitignore | 2 + vendor/yunion.io/x/jsonutils/errors.go | 6 +- vendor/yunion.io/x/jsonutils/go.mod | 3 +- vendor/yunion.io/x/jsonutils/go.sum | 5 ++ vendor/yunion.io/x/jsonutils/string.go | 3 +- vendor/yunion.io/x/jsonutils/utils.go | 4 +- .../x/pkg/util/reflectutils/ambiguous.go | 4 +- vendor/yunion.io/x/sqlchemy/.gitignore | 15 ++++ vendor/yunion.io/x/sqlchemy/case.go | 68 +++++++++++++++++ vendor/yunion.io/x/sqlchemy/field_update.go | 2 +- vendor/yunion.io/x/sqlchemy/functions.go | 74 ++++++++++--------- vendor/yunion.io/x/sqlchemy/query.go | 4 + 48 files changed, 230 insertions(+), 132 deletions(-) create mode 100644 vendor/yunion.io/x/sqlchemy/.gitignore create mode 100644 vendor/yunion.io/x/sqlchemy/case.go diff --git a/go.mod b/go.mod index ee60bb92fc..91c4c73c6e 100644 --- a/go.mod +++ b/go.mod @@ -128,11 +128,11 @@ require ( k8s.io/cluster-bootstrap v0.17.3 k8s.io/kubernetes v1.16.0 yunion.io/x/executor v0.0.0-20200227030256-a18417815e74 - yunion.io/x/jsonutils v0.0.0-20200710080709-7ca71cdb9383 + yunion.io/x/jsonutils v0.0.0-20200814075449-927b118adbd8 yunion.io/x/log v0.0.0-20200313080802-57a4ce5966b3 - yunion.io/x/pkg v0.0.0-20200713121502-18154120c49b + yunion.io/x/pkg v0.0.0-20200814072949-4f1b541857d6 yunion.io/x/s3cli v0.0.0-20190917004522-13ac36d8687e - yunion.io/x/sqlchemy v0.0.0-20200702064124-195445bc4b11 + yunion.io/x/sqlchemy v0.0.0-20200814052348-164f1f20f8a6 yunion.io/x/structarg v0.0.0-20200720093445-9f850fa222ce ) diff --git a/go.sum b/go.sum index c9fffaa6cd..699a1780ee 100644 --- a/go.sum +++ b/go.sum @@ -1108,8 +1108,8 @@ vbom.ml/util v0.0.0-20160121211510-db5cfe13f5cc/go.mod h1:so/NYdZXCz+E3ZpW0uAoCj yunion.io/x/executor v0.0.0-20200227030256-a18417815e74 h1:A15C6VdVRWvmQ9pAJHrUs9yan5qKlYH7uaRxHg1kRbk= yunion.io/x/executor v0.0.0-20200227030256-a18417815e74/go.mod h1:Uxuou9WQIeJXNpy7t2fPLL0BYLvLiMvGQwY7Qc6aSws= yunion.io/x/jsonutils v0.0.0-20190625054549-a964e1e8a051/go.mod h1:4N0/RVzsYL3kH3WE/H1BjUQdFiWu50JGCFQuuy+Z634= -yunion.io/x/jsonutils v0.0.0-20200710080709-7ca71cdb9383 h1:XEhTD+FGjBjEIWwcY0Ez1lY3oTTzjUOcRgH/i4eFM5A= -yunion.io/x/jsonutils v0.0.0-20200710080709-7ca71cdb9383/go.mod h1:3U5hspYn9apQHaXKY+fJ4Qgwjey32Kc+Mq+mUe9NamQ= +yunion.io/x/jsonutils v0.0.0-20200814075449-927b118adbd8 h1:KQVw5EmohJCqBDMdZ3fAcOQNNMIYgVuNCNWNwg4EM3A= +yunion.io/x/jsonutils v0.0.0-20200814075449-927b118adbd8/go.mod h1:p0nyMqGA/apTxxyLIU/o1k4V7Vujl2O6ey30L594sYE= yunion.io/x/log v0.0.0-20190514041436-04ce53b17c6b/go.mod h1:+gauLs73omeJAPlsXcevLsJLKixV+sR/E7WSYTSx1fE= yunion.io/x/log v0.0.0-20190629062853-9f6483a7103d h1:59zrDL7Ft+hDukguJRmLr/Gdu/9V75x+yX99ovZwfaA= yunion.io/x/log v0.0.0-20190629062853-9f6483a7103d/go.mod h1:LC6f/4FozL0iaAbnFt2eDX9jlsyo3WiOUPm03d7+U4U= @@ -1117,13 +1117,11 @@ yunion.io/x/log v0.0.0-20200313080802-57a4ce5966b3 h1:5Wc5hkB8PtMudmHuzCyok960Ru yunion.io/x/log v0.0.0-20200313080802-57a4ce5966b3/go.mod h1:LC6f/4FozL0iaAbnFt2eDX9jlsyo3WiOUPm03d7+U4U= yunion.io/x/pkg v0.0.0-20190620104149-945c25821dbf/go.mod h1:t6rEGG2sQ4J7DhFxSZVOTjNd0YO/KlfWQyK1W4tog+E= yunion.io/x/pkg v0.0.0-20190628082551-f4033ba2ea30/go.mod h1:t6rEGG2sQ4J7DhFxSZVOTjNd0YO/KlfWQyK1W4tog+E= -yunion.io/x/pkg v0.0.0-20200708071451-a663dc94e16b h1:wwPzH8iMRYjtaSM2pBN7nOqeZxR4XW5wdz2VE1KH/Ug= -yunion.io/x/pkg v0.0.0-20200708071451-a663dc94e16b/go.mod h1:t6rEGG2sQ4J7DhFxSZVOTjNd0YO/KlfWQyK1W4tog+E= -yunion.io/x/pkg v0.0.0-20200713121502-18154120c49b h1:Ov/eKwwNeQje7SggkopExzcCW/GfaUouvXkcY6RUEcM= -yunion.io/x/pkg v0.0.0-20200713121502-18154120c49b/go.mod h1:t6rEGG2sQ4J7DhFxSZVOTjNd0YO/KlfWQyK1W4tog+E= +yunion.io/x/pkg v0.0.0-20200814072949-4f1b541857d6 h1:UarEDTBGkgcgc+nc+PZ75uo9M9+jiOGd5P2B90TxDNw= +yunion.io/x/pkg v0.0.0-20200814072949-4f1b541857d6/go.mod h1:t6rEGG2sQ4J7DhFxSZVOTjNd0YO/KlfWQyK1W4tog+E= yunion.io/x/s3cli v0.0.0-20190917004522-13ac36d8687e h1:v+EzIadodSwkdZ/7bremd7J8J50Cise/HCylsOJngmo= yunion.io/x/s3cli v0.0.0-20190917004522-13ac36d8687e/go.mod h1:0iFKpOs1y4lbCxeOmq3Xx/0AcQoewVPwj62eRluioEo= -yunion.io/x/sqlchemy v0.0.0-20200702064124-195445bc4b11 h1:srrssomGJLh4OaDaY/1so+2FUBjZxdwQx/1pZ6403YU= -yunion.io/x/sqlchemy v0.0.0-20200702064124-195445bc4b11/go.mod h1:FTdwPdGhMgh4E+UFXc9klI1Ok34fMuybTT+jLhOaIjI= +yunion.io/x/sqlchemy v0.0.0-20200814052348-164f1f20f8a6 h1:k7E8Zjwzyk/lo1dDO0jtLbODwYRNv+w/zsUJrKWCXvo= +yunion.io/x/sqlchemy v0.0.0-20200814052348-164f1f20f8a6/go.mod h1:FTdwPdGhMgh4E+UFXc9klI1Ok34fMuybTT+jLhOaIjI= yunion.io/x/structarg v0.0.0-20200720093445-9f850fa222ce h1:kU8xE7O5uZ1GSJVMZHoJ+jrNL7csUQHYGyAPW9QfNpE= yunion.io/x/structarg v0.0.0-20200720093445-9f850fa222ce/go.mod h1:EP6NSv2C0zzqBDTKumv8hPWLb3XvgMZDHQRfyuOrQng= diff --git a/pkg/apis/cloudcommon/proxy/proxy.go b/pkg/apis/cloudcommon/proxy/proxy.go index 1e67e39213..0290043485 100644 --- a/pkg/apis/cloudcommon/proxy/proxy.go +++ b/pkg/apis/cloudcommon/proxy/proxy.go @@ -57,7 +57,7 @@ type ProxySettingResourceInput struct { // swagger:ignore // Deprecated - ProxySettingId string `json:"proxy_setting_id" "yunion:deprecated-by":"proxy_setting"` + ProxySettingId string `json:"proxy_setting_id" yunion-deprecated-by:"proxy_setting"` } type ProxySettingTestInput struct { diff --git a/pkg/apis/compute/api.go b/pkg/apis/compute/api.go index 83e343c11e..24ceadf927 100644 --- a/pkg/apis/compute/api.go +++ b/pkg/apis/compute/api.go @@ -285,7 +285,7 @@ type ServerConfigs struct { // swagger:ignore // Deprecated // alias for InstanceType - Sku string `json:"sku" "yunion:deprecated-by":"instance_type"` + Sku string `json:"sku" yunion-deprecated-by:"instance_type"` // 虚拟机高可用(创建备机) // default: false @@ -359,7 +359,7 @@ type ServerCreateInput struct { // swagger:ignore // Deprecated - KeypairId string `json:"keypair_id" "yunion:deprecated-by":"keypair"` + KeypairId string `json:"keypair_id" yunion-deprecated-by:"keypair"` // 秘钥对Id // required: false diff --git a/pkg/apis/compute/cachedloadbalanceracl.go b/pkg/apis/compute/cachedloadbalanceracl.go index 5e1f53719c..b29cb88495 100644 --- a/pkg/apis/compute/cachedloadbalanceracl.go +++ b/pkg/apis/compute/cachedloadbalanceracl.go @@ -42,7 +42,7 @@ type LoadbalancerAclResourceInput struct { // swagger:ignore // Deprecated - AclId string `json:"acl_id" "yunion:deprecated-by":"acl"` + AclId string `json:"acl_id" yunion-deprecated-by:"acl"` } type LoadbalancerAclFilterListInput struct { diff --git a/pkg/apis/compute/cachedloadbalancercertificate.go b/pkg/apis/compute/cachedloadbalancercertificate.go index 459678d834..0ee7994ca4 100644 --- a/pkg/apis/compute/cachedloadbalancercertificate.go +++ b/pkg/apis/compute/cachedloadbalancercertificate.go @@ -43,7 +43,7 @@ type LoadbalancerCertificateResourceInput struct { // swagger:ignore // Deprecated - CertificateId string `json:"certificate_id" "yunion:deprecated-by":"certificate"` + CertificateId string `json:"certificate_id" yunion-deprecated-by:"certificate"` } type LoadbalancerCertificateFilterListInput struct { diff --git a/pkg/apis/compute/cloudaccount.go b/pkg/apis/compute/cloudaccount.go index 5a4e0d598e..f5c9cc1cba 100644 --- a/pkg/apis/compute/cloudaccount.go +++ b/pkg/apis/compute/cloudaccount.go @@ -66,7 +66,7 @@ type CloudenvResourceListInput struct { Providers []string `json:"providers"` // swagger:ignore // Deprecated - Provider []string `json:"provider" "yunion:deprecated-by":"providers"` + Provider []string `json:"provider" yunion-deprecated-by:"providers"` // 列出指定云平台品牌的资源,一般来说brand和provider相同,除了以上支持的provider之外,还支持以下band // @@ -77,7 +77,7 @@ type CloudenvResourceListInput struct { Brands []string `json:"brands"` // swagger:ignore // Deprecated - Brand []string `json:"brand" "yunion:deprecated-by":"brands"` + Brand []string `json:"brand" yunion-deprecated-by:"brands"` // 列出指定云环境的资源,支持云环境如下: // @@ -227,7 +227,7 @@ type CloudaccountListInput struct { // 代理 ProxySetting string `json:"proxy_setting"` // swagger:ignore - ProxySettingId string `json:"proxy_setting_id" "yunion:deprecated-by":"proxy_setting"` + ProxySettingId string `json:"proxy_setting_id" yunion-deprecated-by:"proxy_setting"` } type ProviderProject struct { diff --git a/pkg/apis/compute/cloudprovider.go b/pkg/apis/compute/cloudprovider.go index d44a6a4c43..031a0bbfa8 100644 --- a/pkg/apis/compute/cloudprovider.go +++ b/pkg/apis/compute/cloudprovider.go @@ -147,15 +147,15 @@ type CloudproviderResourceInput struct { // swagger:ignore // Deprecated // description: this param will be deprecate at 3.0 - Manager string `json:"manager" "yunion:deprecated-by":"cloudprovider"` + Manager string `json:"manager" yunion-deprecated-by:"cloudprovider"` // swagger:ignore // Deprecated // description: this param will be deprecate at 3.0 - ManagerId string `json:"manager_id" "yunion:deprecated-by":"cloudprovider"` + ManagerId string `json:"manager_id" yunion-deprecated-by:"cloudprovider"` // swagger:ignore // Deprecated // description: this param will be deprecate at 3.0 - CloudproviderId string `json:"cloudprovider_id" "yunion:deprecated-by":"cloudprovider"` + CloudproviderId string `json:"cloudprovider_id" yunion-deprecated-by:"cloudprovider"` } type ManagedResourceListInput struct { @@ -169,15 +169,15 @@ type ManagedResourceListInput struct { // swagger:ignore // Deprecated // description: this param will be deprecate at 3.0 - CloudaccountId string `json:"cloudaccount_id" "yunion:deprecated-by":"cloudaccount"` + CloudaccountId string `json:"cloudaccount_id" yunion-deprecated-by:"cloudaccount"` // swagger:ignore // Deprecated // description: this param will be deprecate at 3.0 - Account string `json:"account" "yunion:deprecated-by":"cloudaccount"` + Account string `json:"account" yunion-deprecated-by:"cloudaccount"` // swagger:ignore // Deprecated // description: this param will be deprecate at 3.0 - AccountId string `json:"account_id" "yunion:deprecated-by":"cloudaccount"` + AccountId string `json:"account_id" yunion-deprecated-by:"cloudaccount"` // 过滤资源,是否为非OneCloud内置私有云管理的资源 // default: false diff --git a/pkg/apis/compute/dbinstance.go b/pkg/apis/compute/dbinstance.go index 239a2660d4..1223e4e122 100644 --- a/pkg/apis/compute/dbinstance.go +++ b/pkg/apis/compute/dbinstance.go @@ -172,7 +172,7 @@ type SDBInstanceRecoveryConfigInput struct { apis.Meta // swagger:ignore - DBInstancebackup string `json:"dbinstancebackup" "yunion:deprecated-by":"dbinstancebackup_id"` + DBInstancebackup string `json:"dbinstancebackup" yunion-deprecated-by:"dbinstancebackup_id"` // 备份Id // @@ -327,7 +327,7 @@ type DBInstanceResourceInput struct { // swagger:ignore // Deprecated - DBInstanceId string `json:"dbinstance_id" "yunion:deprecated-by":"dbinstance"` + DBInstanceId string `json:"dbinstance_id" yunion-deprecated-by:"dbinstance"` } type DBInstanceFilterListInputBase struct { diff --git a/pkg/apis/compute/disk.go b/pkg/apis/compute/disk.go index 36d4a52dd7..410b717cc7 100644 --- a/pkg/apis/compute/disk.go +++ b/pkg/apis/compute/disk.go @@ -88,7 +88,7 @@ type SnapshotPolicyResourceInput struct { // swagger:ignore // Deprecated // filter disk by snapshotpolicy_id - SnapshotpolicyId string `json:"snapshotpolicy_id" "yunion:deprecated-by":"snapshotpolicy"` + SnapshotpolicyId string `json:"snapshotpolicy_id" yunion-deprecated-by:"snapshotpolicy"` } type SnapshotPolicyFilterListInput struct { @@ -113,7 +113,7 @@ type DiskListInput struct { // swagger:ignore // Deprecated // filter by disk type - Type string `json:"type" "yunion:deprecated-by":"disk_type"` + Type string `json:"type" yunion-deprecated-by:"disk_type"` // 过滤指定disk_type的磁盘列表,可能的值为:sys, data, swap. volume // // | disk_type值 | 说明 | @@ -137,13 +137,13 @@ type DiskListInput struct { Template string `json:"template"` // swagger:ignore // Deprecated - TemplateId string `json:"template_id" "yunion:deprecated-by":"template"` + TemplateId string `json:"template_id" yunion-deprecated-by:"template"` // 快照 Snapshot string `json:"snapshot"` // swagger:ignore // Deprecated - SnapshotId string `json:"snapshot_id" "yunion:deprecated-by":"snapshot"` + SnapshotId string `json:"snapshot_id" yunion-deprecated-by:"snapshot"` } type DiskResourceInput struct { @@ -152,7 +152,7 @@ type DiskResourceInput struct { // swagger:ignore // Deprecated // filter by disk_id - DiskId string `json:"disk_id" "yunion:deprecated-by":"disk"` + DiskId string `json:"disk_id" yunion-deprecated-by:"disk"` } type DiskFilterListInputBase struct { diff --git a/pkg/apis/compute/elasticcache.go b/pkg/apis/compute/elasticcache.go index 6c34a1a90c..ffa44eedd0 100644 --- a/pkg/apis/compute/elasticcache.go +++ b/pkg/apis/compute/elasticcache.go @@ -53,7 +53,7 @@ type ELasticcacheResourceInput struct { // swagger:ignore // Deprecated - ElasticcacheId string `json:"elasticcache_id" "yunion:deprecated-by":"elasticcache"` + ElasticcacheId string `json:"elasticcache_id" yunion-deprecated-by:"elasticcache"` } type ElasticcacheFilterListInput struct { diff --git a/pkg/apis/compute/geo_input.go b/pkg/apis/compute/geo_input.go index 0c73479600..009e36a7ed 100644 --- a/pkg/apis/compute/geo_input.go +++ b/pkg/apis/compute/geo_input.go @@ -24,15 +24,15 @@ type CloudregionResourceInput struct { // swagger:ignore // Deprecated // description: this param will be deprecate at 3.0 - CloudregionId string `json:"cloudregion_id" "yunion:deprecated-by":"cloudregion"` + CloudregionId string `json:"cloudregion_id" yunion-deprecated-by:"cloudregion"` // swagger:ignore // Deprecated // description: this param will be deprecate at 3.0 - Region string `json:"region" "yunion:deprecated-by":"cloudregion"` + Region string `json:"region" yunion-deprecated-by:"cloudregion"` // swagger:ignore // Deprecated // description: this param will be deprecate at 3.0 - RegionId string `json:"region_id" "yunion:deprecated-by":"cloudregion"` + RegionId string `json:"region_id" yunion-deprecated-by:"cloudregion"` } type RegionalFilterListInput struct { @@ -134,5 +134,5 @@ type ZoneResourceInput struct { // swagger:ignore // Deprecated - ZoneId string `json:"zone_id" "yunion:deprecated-by":"zone"` + ZoneId string `json:"zone_id" yunion-deprecated-by:"zone"` } diff --git a/pkg/apis/compute/globalvpc.go b/pkg/apis/compute/globalvpc.go index 093b597598..8faf539342 100644 --- a/pkg/apis/compute/globalvpc.go +++ b/pkg/apis/compute/globalvpc.go @@ -42,7 +42,7 @@ type GlobalVpcResourceInput struct { // swagger:ignore // Deprecated - GlobalvpcId string `json:"globalvpc_id" "yunion:deprecated-by":"globalvpc"` + GlobalvpcId string `json:"globalvpc_id" yunion-deprecated-by:"globalvpc"` } type GlobalVpcResourceListInput struct { diff --git a/pkg/apis/compute/guests.go b/pkg/apis/compute/guests.go index af515b9494..27d9c27019 100644 --- a/pkg/apis/compute/guests.go +++ b/pkg/apis/compute/guests.go @@ -30,13 +30,13 @@ type ServerListInput struct { HostFilterListInput - NetworkFilterListInput `"yunion:ambiguous-prefix":"vpc_"` + NetworkFilterListInput `yunion-ambiguous-prefix:"vpc_"` billing.BillingResourceListInput GroupFilterListInput SecgroupFilterListInput - //DiskFilterListInput `"yunion:ambiguous-prefix":"storage_"` + //DiskFilterListInput `yunion-ambiguous-prefix:"storage_"` ScalingGroupFilterListInput // 只列出裸金属主机 @@ -66,7 +66,7 @@ type ServerListInput struct { // 列出可以挂载磁盘的主机 AttachableServersForDisk string `json:"attachable_servers_for_disk"` // Deprecated:列出可以挂载磁盘的主机 - Disk string `json:"disk" "yunion:deprecated-by":"attachable_servers_for_disk"` + Disk string `json:"disk" yunion-deprecated-by:"attachable_servers_for_disk"` // 按主机资源类型进行排序 // enum: shared,prepaid,dedicated @@ -267,15 +267,15 @@ type ServerResourceInput struct { // swagger:ignore // Deprecated // Filter by guest Id - ServerId string `json:"server_id" "yunion:deprecated-by":"server"` + ServerId string `json:"server_id" yunion-deprecated-by:"server"` // swagger:ignore // Deprecated // Filter by guest Id - Guest string `json:"guest" "yunion:deprecated-by":"server"` + Guest string `json:"guest" yunion-deprecated-by:"server"` // swagger:ignore // Deprecated // Filter by guest Id - GuestId string `json:"guest_id" "yunion:deprecated-by":"server"` + GuestId string `json:"guest_id" yunion-deprecated-by:"server"` } type ServerFilterListInput struct { diff --git a/pkg/apis/compute/host.go b/pkg/apis/compute/host.go index 106bbf6cf7..9c1f31c1e3 100644 --- a/pkg/apis/compute/host.go +++ b/pkg/apis/compute/host.go @@ -224,7 +224,7 @@ type HostResourceInput struct { // swagger:ignore // Deprecated // filter by host_id - HostId string `json:"host_id" "yunion:deprecated-by":"host"` + HostId string `json:"host_id" yunion-deprecated-by:"host"` } type HostRegisterMetadata struct { diff --git a/pkg/apis/compute/hostjoin.go b/pkg/apis/compute/hostjoin.go index 63cafdb052..6b31e5ad59 100644 --- a/pkg/apis/compute/hostjoin.go +++ b/pkg/apis/compute/hostjoin.go @@ -21,7 +21,7 @@ type HostJointResourceDetailsBase struct { Host string `json:"host"` // 裸金属服务器名称 // Deprecated - Baremetal string `json:"baremetal" "yunion:deprecated-by":"host"` + Baremetal string `json:"baremetal" yunion-deprecated-by:"host"` } type HostJointResourceDetails struct { diff --git a/pkg/apis/compute/input.go b/pkg/apis/compute/input.go index 51ab9195d5..8e4afd2c7b 100644 --- a/pkg/apis/compute/input.go +++ b/pkg/apis/compute/input.go @@ -149,7 +149,7 @@ type GuestTemplateFilterListInput struct { GuestTemplate string `json:"guest_template"` // swagger:ignore // Deprecated - GuestTemplateId string `json:"guest_template_id" "yunion:deprecated-by":"guest_template"` + GuestTemplateId string `json:"guest_template_id" yunion-deprecated-by:"guest_template"` } type ServiceCatalogListInput struct { diff --git a/pkg/apis/compute/instance_group.go b/pkg/apis/compute/instance_group.go index ace0b1b36a..fee2bf31b1 100644 --- a/pkg/apis/compute/instance_group.go +++ b/pkg/apis/compute/instance_group.go @@ -50,7 +50,7 @@ type GroupResourceInput struct { // swagger:ignore // Deprecated // Filter by instance group Id - GroupId string `json:"group_id" "yunion:deprecated-by":"group"` + GroupId string `json:"group_id" yunion-deprecated-by:"group"` } type GroupFilterListInput struct { diff --git a/pkg/apis/compute/loadbalancer.go b/pkg/apis/compute/loadbalancer.go index 383c8b3ab6..7962ffcc69 100644 --- a/pkg/apis/compute/loadbalancer.go +++ b/pkg/apis/compute/loadbalancer.go @@ -210,7 +210,7 @@ type LoadbalancerResourceInput struct { // swagger:ignore // Deprecated - LoadbalancerId string `json:"loadbalancer_id" "yunion:deprecated-by":"loadbalancer"` + LoadbalancerId string `json:"loadbalancer_id" yunion-deprecated-by:"loadbalancer"` } type LoadbalancerFilterListInput struct { diff --git a/pkg/apis/compute/loadbalancerbackendgroup.go b/pkg/apis/compute/loadbalancerbackendgroup.go index 55e5002fd8..562f5de13e 100644 --- a/pkg/apis/compute/loadbalancerbackendgroup.go +++ b/pkg/apis/compute/loadbalancerbackendgroup.go @@ -39,7 +39,7 @@ type LoadbalancerBackendGroupResourceInput struct { // swagger:ignore // Deprecated - BackendGroupId string `json:"backend_group_id" "yunion:deprecated-by":"backend_group"` + BackendGroupId string `json:"backend_group_id" yunion-deprecated-by:"backend_group"` } type LoadbalancerBackendGroupFilterListInput struct { diff --git a/pkg/apis/compute/loadbalancercluster.go b/pkg/apis/compute/loadbalancercluster.go index 9e1de908e3..ab4151ba09 100644 --- a/pkg/apis/compute/loadbalancercluster.go +++ b/pkg/apis/compute/loadbalancercluster.go @@ -45,7 +45,7 @@ type LoadbalancerClusterResourceInput struct { // swagger:ignore // Deprecated - ClusterId string `json:"cluster_id" "yunion:deprecated-by":"cluster"` + ClusterId string `json:"cluster_id" yunion-deprecated-by:"cluster"` } type LoadbalancerClusterFilterListInput struct { diff --git a/pkg/apis/compute/loadbalancerlistener.go b/pkg/apis/compute/loadbalancerlistener.go index 884c6d91f5..eb8437b5f1 100644 --- a/pkg/apis/compute/loadbalancerlistener.go +++ b/pkg/apis/compute/loadbalancerlistener.go @@ -45,7 +45,7 @@ type LoadbalancerListenerResourceInput struct { // 负载均衡监听器ID // swagger:ignore // Deprecated - ListenerId string `json:"listener_id" "yunion:deprecated-by":"listener"` + ListenerId string `json:"listener_id" yunion-deprecated-by:"listener"` } type LoadbalancerListenerFilterListInput struct { diff --git a/pkg/apis/compute/natgateway.go b/pkg/apis/compute/natgateway.go index 072d2c4e71..e857662e72 100644 --- a/pkg/apis/compute/natgateway.go +++ b/pkg/apis/compute/natgateway.go @@ -89,7 +89,7 @@ type NatGatewayResourceInput struct { // swagger:ignore // Deprecated - NatgatewayId string `json:"natgateway_id" "yunion:deprecated-by":"natgateway"` + NatgatewayId string `json:"natgateway_id" yunion-deprecated-by:"natgateway"` } type NatGatewayFilterListInput struct { diff --git a/pkg/apis/compute/network.go b/pkg/apis/compute/network.go index aeff7ca9eb..34f770e777 100644 --- a/pkg/apis/compute/network.go +++ b/pkg/apis/compute/network.go @@ -24,7 +24,7 @@ type WireResourceInput struct { // swagger:ignore // Deprecated // fitler by wire id - WireId string `json:"wire_id" "yunion:deprecated-by":"wire"` + WireId string `json:"wire_id" yunion-deprecated-by:"wire"` } type WireFilterListBase struct { @@ -47,7 +47,7 @@ type NetworkResourceInput struct { // swagger:ignore // Deprecated // filter by networkId - NetworkId string `json:"network_id" "yunion:deprecated-by":"network"` + NetworkId string `json:"network_id" yunion-deprecated-by:"network"` } type NetworkFilterListBase struct { diff --git a/pkg/apis/compute/schedtag.go b/pkg/apis/compute/schedtag.go index f12eb097ff..e54523b98b 100644 --- a/pkg/apis/compute/schedtag.go +++ b/pkg/apis/compute/schedtag.go @@ -45,7 +45,7 @@ type SchedtagResourceInput struct { // swagger:ignore // Deprecated // filter by schedtag_id - SchedtagId string `json:"schedtag_id" "yunion:deprecated-by":"schedtag"` + SchedtagId string `json:"schedtag_id" yunion-deprecated-by:"schedtag"` } type SchedtagFilterListInput struct { @@ -69,7 +69,7 @@ type SchedtagListInput struct { // swagger:ignore // Deprecated // filter by type, alias for resource_type - Type string `json:"type" "yunion:deprecated-by":"resource_type"` + Type string `json:"type" yunion-deprecated-by:"resource_type"` DefaultStrategy []string `json:"default_strategy"` } diff --git a/pkg/apis/compute/secgroup.go b/pkg/apis/compute/secgroup.go index eae5a8817d..b9ea2f333f 100644 --- a/pkg/apis/compute/secgroup.go +++ b/pkg/apis/compute/secgroup.go @@ -194,7 +194,7 @@ type SecgroupResourceInput struct { // swagger:ignore // Deprecated // filter by secgroup_id - SecgroupId string `json:"secgroup_id" "yunion:deprecated-by":"secgroup"` + SecgroupId string `json:"secgroup_id" yunion-deprecated-by:"secgroup"` // 模糊匹配安全组规则名称 SecgroupName string `json:"secgroup_name"` diff --git a/pkg/apis/compute/storage_const.go b/pkg/apis/compute/storage_const.go index 53048754ea..3e266d4d11 100644 --- a/pkg/apis/compute/storage_const.go +++ b/pkg/apis/compute/storage_const.go @@ -144,7 +144,7 @@ type StorageResourceInput struct { // swagger:ignore // Deprecated // filter by storage_id - StorageId string `json:"storage_id" "yunion:deprecated-by":"storage"` + StorageId string `json:"storage_id" yunion-deprecated-by:"storage"` } type StorageFilterListInputBase struct { diff --git a/pkg/apis/compute/storagecachedimage.go b/pkg/apis/compute/storagecachedimage.go index bcd4064077..61096ba757 100644 --- a/pkg/apis/compute/storagecachedimage.go +++ b/pkg/apis/compute/storagecachedimage.go @@ -48,13 +48,13 @@ type StoragecachedimageListInput struct { Storagecache string `json:"storagecache"` // Deprecated // swagger:ignore - StoragecacheId string `json:"storagecache_id" "yunion:deprecated-by":"storagecache"` + StoragecacheId string `json:"storagecache_id" yunion-deprecated-by:"storagecache"` // 以镜像缓存过滤 Cachedimage string `json:"cachedimage"` // Deprecated // swagger:ignore - CachedimageId string `json:"cachedimage_id" "yunion:deprecated-by":"cachedimage"` + CachedimageId string `json:"cachedimage_id" yunion-deprecated-by:"cachedimage"` // 镜像状态 Status []string `json:"status"` diff --git a/pkg/apis/compute/vpc.go b/pkg/apis/compute/vpc.go index 01ddb517d2..53c41a3255 100644 --- a/pkg/apis/compute/vpc.go +++ b/pkg/apis/compute/vpc.go @@ -80,7 +80,7 @@ type VpcResourceInput struct { // swagger:ignore // Deprecated // filter by vpc Id - VpcId string `json:"vpc_id" "yunion:deprecated-by":"vpc"` + VpcId string `json:"vpc_id" yunion-deprecated-by:"vpc"` } type VpcFilterListInputBase struct { diff --git a/pkg/apis/identity/identityprovider.go b/pkg/apis/identity/identityprovider.go index 067fad199f..86b6ad32e5 100644 --- a/pkg/apis/identity/identityprovider.go +++ b/pkg/apis/identity/identityprovider.go @@ -73,7 +73,7 @@ type IdentityProviderCreateInput struct { TargetDomain string `json:"target_domain"` // swagger:ignore // Deprecated - TargetDomainId string `json:"target_domain_id" "yunion:deprecated-by":"target_domain"` + TargetDomainId string `json:"target_domain_id" yunion-deprecated-by:"target_domain"` // 新建域的时候是否自动新建第一个项目 AutoCreateProject *bool `json:"auto_create_project"` diff --git a/pkg/apis/identity/input.go b/pkg/apis/identity/input.go index e4da700fa4..9552fe0819 100644 --- a/pkg/apis/identity/input.go +++ b/pkg/apis/identity/input.go @@ -49,22 +49,22 @@ type ProjectFilterListInput struct { ProjectDomain string `json:"project_domain"` // swagger:ignore // Deprecated - ProjectDomainId string `json:"project_domain_id" "yunion:deprecated-by":"project-domain"` + ProjectDomainId string `json:"project_domain_id" yunion-deprecated-by:"project-domain"` // 以项目(ID或Name)过滤列表结果 Project string `json:"project"` // swagger:ignore // Deprecated // filter by project_id - ProjectId string `json:"project_id" "yunion:deprecated-by":"project"` + ProjectId string `json:"project_id" yunion-deprecated-by:"project"` // swagger:ignore // Deprecated // filter by tenant - Tenant string `json:"tenant" "yunion:deprecated-by":"project"` + Tenant string `json:"tenant" yunion-deprecated-by:"project"` // swagger:ignore // Deprecated // filter by tenant_id - TenantId string `json:"tenant_id" "yunion:deprecated-by":"project"` + TenantId string `json:"tenant_id" yunion-deprecated-by:"project"` } type UserFilterListInput struct { @@ -79,7 +79,7 @@ type UserFilterListInput struct { // swagger:ignore // Deprecated // filter by user_id - UserId string `json:"user_id" "yunion:deprecated-by":"user"` + UserId string `json:"user_id" yunion-deprecated-by:"user"` } type GroupFilterListInput struct { @@ -94,7 +94,7 @@ type GroupFilterListInput struct { // swagger:ignore // Deprecated // filter by group_id - GroupId string `json:"group_id" "yunion:deprecated-by":"group"` + GroupId string `json:"group_id" yunion-deprecated-by:"group"` } type RoleFilterListInput struct { @@ -109,7 +109,7 @@ type RoleFilterListInput struct { // swagger:ignore // Deprecated // filter by role_id - RoleId string `json:"role_id" "yunion:deprecated-by":"role"` + RoleId string `json:"role_id" yunion-deprecated-by:"role"` } type ServiceFilterListInput struct { @@ -121,7 +121,7 @@ type ServiceFilterListInput struct { // swagger:ignore // Deprecated // filter by service_id - ServiceId string `json:"service_id" "yunion:deprecated-by":"service"` + ServiceId string `json:"service_id" yunion-deprecated-by:"service"` // 以服务名称排序 OrderByService string `json:"order_by_service"` @@ -325,7 +325,7 @@ type RegionFilterListInput struct { Region string `json:"region"` // swagger:ignore // Deprecated - RegionId string `json:"region_id" "yunion:deprecated-by":"region"` + RegionId string `json:"region_id" yunion-deprecated-by:"region"` } type RegionListInput struct { diff --git a/pkg/apis/input.go b/pkg/apis/input.go index b9a8665720..59f3986b50 100644 --- a/pkg/apis/input.go +++ b/pkg/apis/input.go @@ -21,15 +21,15 @@ type DomainizedResourceInput struct { // swagger:ignore // Deprecated - Domain string `json:"domain" "yunion:deprecated-by":"project_domain"` + Domain string `json:"domain" yunion-deprecated-by:"project_domain"` // swagger:ignore // Deprecated // Project domain Id filter, alias for project_domain - ProjectDomainId string `json:"project_domain_id" "yunion:deprecated-by":"project_domain"` + ProjectDomainId string `json:"project_domain_id" yunion-deprecated-by:"project_domain"` // swagger:ignore // Deprecated // Domain Id filter, alias for project_domain - DomainId string `json:"domain_id" "yunion:deprecated-by":"project_domain"` + DomainId string `json:"domain_id" yunion-deprecated-by:"project_domain"` } type ProjectizedResourceInput struct { @@ -39,15 +39,15 @@ type ProjectizedResourceInput struct { // swagger:ignore // Deprecated // Filter by project_id, alias for project - ProjectId string `json:"project_id" "yunion:deprecated-by":"project"` + ProjectId string `json:"project_id" yunion-deprecated-by:"project"` // swagger:ignore // Deprecated // Filter by tenant ID or Name, alias for project - Tenant string `json:"tenant" "yunion:deprecated-by":"project"` + Tenant string `json:"tenant" yunion-deprecated-by:"project"` // swagger:ignore // Deprecated // Filter by tenant_id, alias for project - TenantId string `json:"tenant_id" "yunion:deprecated-by":"project"` + TenantId string `json:"tenant_id" yunion-deprecated-by:"project"` } type DomainizedResourceCreateInput struct { diff --git a/pkg/apis/list.go b/pkg/apis/list.go index 826cb0e39e..854ca01032 100644 --- a/pkg/apis/list.go +++ b/pkg/apis/list.go @@ -50,7 +50,7 @@ type ProjectizedResourceListInput struct { OrderByProject string `json:"order_by_project"` // swagger:ignore // Deprecated - OrderByTenant string `json:"order_by_tenant" "yunion:deprecated-by":"order_by_project"` + OrderByTenant string `json:"order_by_tenant" yunion-deprecated-by:"order_by_project"` } type UserResourceListInput struct { @@ -59,7 +59,7 @@ type UserResourceListInput struct { // swagger:ignore // Deprecated // Filter by userId - UserId string `json:"user_id" "yunion:deprecated-by":"user"` + UserId string `json:"user_id" yunion-deprecated-by:"user"` } type ModelBaseListInput struct { diff --git a/pkg/apis/output.go b/pkg/apis/output.go index 8748839003..642f3b4c59 100644 --- a/pkg/apis/output.go +++ b/pkg/apis/output.go @@ -137,11 +137,11 @@ type ProjectizedResourceInfo struct { // 资源归属项目的ID(向后兼容别名) // Deprecated - TenantId string `json:"project_id" "yunion:deprecated-by":"tenant_id"` + TenantId string `json:"project_id" yunion-deprecated-by:"tenant_id"` // 资源归属项目的名称(向后兼容别名) // Deprecated - Tenant string `json:"project" "yunion:deprecated-by":"tenant"` + Tenant string `json:"project" yunion-deprecated-by:"tenant"` } type ScopedResourceBaseInfo struct { diff --git a/pkg/apis/yunionconf/input.go b/pkg/apis/yunionconf/input.go index 090358f80e..f008f7d862 100644 --- a/pkg/apis/yunionconf/input.go +++ b/pkg/apis/yunionconf/input.go @@ -28,14 +28,14 @@ type ParameterListInput struct { // Deprecated // swagger:ignore - ServiceId string `json:"service_id" "yunion:deprecated-by":"service"` + ServiceId string `json:"service_id" yunion-deprecated-by:"service"` // 用户名称或ID User string `json:"user"` // Deprecated // swagger:ignore - UserId string `json:"user_id" "yunion:deprecated-by":"user"` + UserId string `json:"user_id" yunion-deprecated-by:"user"` // filter by name Name []string `json:"name"` diff --git a/vendor/modules.txt b/vendor/modules.txt index 84d7278c5a..7de41a86da 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -993,12 +993,12 @@ sigs.k8s.io/yaml yunion.io/x/executor/apis yunion.io/x/executor/client yunion.io/x/executor/server -# yunion.io/x/jsonutils v0.0.0-20200710080709-7ca71cdb9383 +# yunion.io/x/jsonutils v0.0.0-20200814075449-927b118adbd8 yunion.io/x/jsonutils # yunion.io/x/log v0.0.0-20200313080802-57a4ce5966b3 yunion.io/x/log yunion.io/x/log/hooks -# yunion.io/x/pkg v0.0.0-20200713121502-18154120c49b +# yunion.io/x/pkg v0.0.0-20200814072949-4f1b541857d6 yunion.io/x/pkg/errors yunion.io/x/pkg/gotypes yunion.io/x/pkg/prettytable @@ -1031,7 +1031,7 @@ yunion.io/x/pkg/util/workqueue yunion.io/x/pkg/utils # yunion.io/x/s3cli v0.0.0-20190917004522-13ac36d8687e yunion.io/x/s3cli -# yunion.io/x/sqlchemy v0.0.0-20200702064124-195445bc4b11 +# yunion.io/x/sqlchemy v0.0.0-20200814052348-164f1f20f8a6 yunion.io/x/sqlchemy # yunion.io/x/structarg v0.0.0-20200720093445-9f850fa222ce yunion.io/x/structarg diff --git a/vendor/yunion.io/x/jsonutils/.gitignore b/vendor/yunion.io/x/jsonutils/.gitignore index 43309f8b1d..9c65ceeed1 100644 --- a/vendor/yunion.io/x/jsonutils/.gitignore +++ b/vendor/yunion.io/x/jsonutils/.gitignore @@ -11,3 +11,5 @@ # Output of the go coverage tool, specifically when used with LiteIDE *.out .idea + +out.gotext.json diff --git a/vendor/yunion.io/x/jsonutils/errors.go b/vendor/yunion.io/x/jsonutils/errors.go index 5768b40144..8bb0dccda3 100644 --- a/vendor/yunion.io/x/jsonutils/errors.go +++ b/vendor/yunion.io/x/jsonutils/errors.go @@ -6,7 +6,7 @@ import ( "yunion.io/x/pkg/errors" ) -var ( +const ( ErrJsonDictFailInsert = errors.Error("fail to insert object") ErrInvalidJsonDict = errors.Error("not a valid JSONDict") @@ -31,8 +31,8 @@ var ( ErrInterfaceUnsupported = errors.Error("do not known how to deserialize json into this interface type") ErrMapKeyMustString = errors.Error("map key must be string") - ErrMisingInputField = errors.Error("missing input field") - ErrNilInputField = errors.Error("nil input field") + ErrMissingInputField = errors.Error("missing input field") + ErrNilInputField = errors.Error("nil input field") ErrYamlMissingDictKey = errors.Error("Cannot find JSONDict key") ErrYamlIllFormat = errors.Error("Illformat") diff --git a/vendor/yunion.io/x/jsonutils/go.mod b/vendor/yunion.io/x/jsonutils/go.mod index 9eec8d311d..7745a7bee7 100644 --- a/vendor/yunion.io/x/jsonutils/go.mod +++ b/vendor/yunion.io/x/jsonutils/go.mod @@ -9,7 +9,8 @@ require ( github.com/pkg/errors v0.8.1 // indirect github.com/sirupsen/logrus v1.4.2 // indirect golang.org/x/crypto v0.0.0-20190621222207-cc06ce4a13d4 // indirect + golang.org/x/text v0.3.0 gopkg.in/yaml.v2 v2.2.2 // indirect yunion.io/x/log v0.0.0-20190514041436-04ce53b17c6b - yunion.io/x/pkg v0.0.0-20200708071451-a663dc94e16b + yunion.io/x/pkg v0.0.0-20200814072949-4f1b541857d6 ) diff --git a/vendor/yunion.io/x/jsonutils/go.sum b/vendor/yunion.io/x/jsonutils/go.sum index c3e7f47bbb..5f3aba9ab5 100644 --- a/vendor/yunion.io/x/jsonutils/go.sum +++ b/vendor/yunion.io/x/jsonutils/go.sum @@ -28,6 +28,7 @@ golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190422165155-953cdadca894 h1:Cz4ceDQGXuKRnVBDTS23GTn/pU5OE2C0WrNTOYK1Uuc= golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= @@ -39,3 +40,7 @@ yunion.io/x/pkg v0.0.0-20200302034534-fdf44d54b070 h1:rKnYgtvMHKmzPEUTkyNjyKOG7w yunion.io/x/pkg v0.0.0-20200302034534-fdf44d54b070/go.mod h1:t6rEGG2sQ4J7DhFxSZVOTjNd0YO/KlfWQyK1W4tog+E= yunion.io/x/pkg v0.0.0-20200708071451-a663dc94e16b h1:wwPzH8iMRYjtaSM2pBN7nOqeZxR4XW5wdz2VE1KH/Ug= yunion.io/x/pkg v0.0.0-20200708071451-a663dc94e16b/go.mod h1:t6rEGG2sQ4J7DhFxSZVOTjNd0YO/KlfWQyK1W4tog+E= +yunion.io/x/pkg v0.0.0-20200713121502-18154120c49b h1:Ov/eKwwNeQje7SggkopExzcCW/GfaUouvXkcY6RUEcM= +yunion.io/x/pkg v0.0.0-20200713121502-18154120c49b/go.mod h1:t6rEGG2sQ4J7DhFxSZVOTjNd0YO/KlfWQyK1W4tog+E= +yunion.io/x/pkg v0.0.0-20200814072949-4f1b541857d6 h1:UarEDTBGkgcgc+nc+PZ75uo9M9+jiOGd5P2B90TxDNw= +yunion.io/x/pkg v0.0.0-20200814072949-4f1b541857d6/go.mod h1:t6rEGG2sQ4J7DhFxSZVOTjNd0YO/KlfWQyK1W4tog+E= diff --git a/vendor/yunion.io/x/jsonutils/string.go b/vendor/yunion.io/x/jsonutils/string.go index 58c41f4a0f..1d6c5decca 100644 --- a/vendor/yunion.io/x/jsonutils/string.go +++ b/vendor/yunion.io/x/jsonutils/string.go @@ -2,6 +2,7 @@ package jsonutils import ( "fmt" + "strconv" "strings" ) @@ -18,7 +19,7 @@ func (this *JSONInt) String() string { } func (this *JSONFloat) String() string { - return fmt.Sprintf("%f", this.data) + return strconv.FormatFloat(this.data, 'g', -1, 64) } func (this *JSONBool) String() string { diff --git a/vendor/yunion.io/x/jsonutils/utils.go b/vendor/yunion.io/x/jsonutils/utils.go index c707da4779..aa15324810 100644 --- a/vendor/yunion.io/x/jsonutils/utils.go +++ b/vendor/yunion.io/x/jsonutils/utils.go @@ -60,7 +60,7 @@ func GetStringArray(o JSONObject, key ...string) ([]string, error) { } func NewTimeString(tm time.Time) *JSONString { - return NewString(tm.Format("2006-01-02T15:04:05Z")) + return NewString(tm.UTC().Format("2006-01-02T15:04:05Z")) } func GetQueryStringArray(query JSONObject, key string) []string { @@ -102,7 +102,7 @@ func CheckRequiredFields(data JSONObject, fields []string) error { for _, f := range fields { jsonVal, ok := jsonMap[f] if !ok { - return errors.Wrap(ErrMisingInputField, f) + return errors.Wrap(ErrMissingInputField, f) } if jsonVal == JSONNull { return errors.Wrap(ErrNilInputField, f) diff --git a/vendor/yunion.io/x/pkg/util/reflectutils/ambiguous.go b/vendor/yunion.io/x/pkg/util/reflectutils/ambiguous.go index bd84c2d3f5..7d422ecf60 100644 --- a/vendor/yunion.io/x/pkg/util/reflectutils/ambiguous.go +++ b/vendor/yunion.io/x/pkg/util/reflectutils/ambiguous.go @@ -19,8 +19,8 @@ import ( ) const ( - TAG_AMBIGUOUS_PREFIX = "yunion:ambiguous-prefix" - TAG_DEPRECATED_BY = "yunion:deprecated-by" + TAG_AMBIGUOUS_PREFIX = "yunion-ambiguous-prefix" + TAG_DEPRECATED_BY = "yunion-deprecated-by" TAG_OLD_DEPRECATED_BY = "deprecated-by" ) diff --git a/vendor/yunion.io/x/sqlchemy/.gitignore b/vendor/yunion.io/x/sqlchemy/.gitignore new file mode 100644 index 0000000000..9c65ceeed1 --- /dev/null +++ b/vendor/yunion.io/x/sqlchemy/.gitignore @@ -0,0 +1,15 @@ +# Binaries for programs and plugins +*.exe +*.exe~ +*.dll +*.so +*.dylib + +# Test binary, build with `go test -c` +*.test + +# Output of the go coverage tool, specifically when used with LiteIDE +*.out +.idea + +out.gotext.json diff --git a/vendor/yunion.io/x/sqlchemy/case.go b/vendor/yunion.io/x/sqlchemy/case.go new file mode 100644 index 0000000000..2678bef91f --- /dev/null +++ b/vendor/yunion.io/x/sqlchemy/case.go @@ -0,0 +1,68 @@ +// Copyright 2019 Yunion +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package sqlchemy + +import ( + "bytes" +) + +type sCaseFieldBranch struct { + whenCondition ICondition + thenField IQueryField +} + +type SCaseFunction struct { + branches []sCaseFieldBranch + elseField IQueryField +} + +func NewFunction(ifunc IFunction, name string) IQueryField { + return &SFunctionFieldBase{ + IFunction: ifunc, + alias: name, + } +} + +func (cf *SCaseFunction) Else(field IQueryField) *SCaseFunction { + cf.elseField = field + return cf +} + +func (cf *SCaseFunction) When(when ICondition, then IQueryField) *SCaseFunction { + cf.branches = append(cf.branches, sCaseFieldBranch{ + whenCondition: when, + thenField: then, + }) + return cf +} + +func NewCase() *SCaseFunction { + return &SCaseFunction{} +} + +func (cf *SCaseFunction) expression() string { + var buf bytes.Buffer + buf.WriteString("CASE ") + for i := range cf.branches { + buf.WriteString("WHEN ") + buf.WriteString(cf.branches[i].whenCondition.WhereClause()) + buf.WriteString(" THEN ") + buf.WriteString(cf.branches[i].thenField.Reference()) + } + buf.WriteString(" ELSE ") + buf.WriteString(cf.elseField.Reference()) + buf.WriteString(" END") + return buf.String() +} diff --git a/vendor/yunion.io/x/sqlchemy/field_update.go b/vendor/yunion.io/x/sqlchemy/field_update.go index 3c97a7f78e..3697ad7bfb 100644 --- a/vendor/yunion.io/x/sqlchemy/field_update.go +++ b/vendor/yunion.io/x/sqlchemy/field_update.go @@ -20,8 +20,8 @@ import ( "reflect" "yunion.io/x/log" - "yunion.io/x/pkg/util/reflectutils" "yunion.io/x/pkg/errors" + "yunion.io/x/pkg/util/reflectutils" ) /* diff --git a/vendor/yunion.io/x/sqlchemy/functions.go b/vendor/yunion.io/x/sqlchemy/functions.go index 7427c7c199..209e59e4db 100644 --- a/vendor/yunion.io/x/sqlchemy/functions.go +++ b/vendor/yunion.io/x/sqlchemy/functions.go @@ -18,43 +18,59 @@ import ( "fmt" "strconv" "strings" + + "yunion.io/x/log" ) -type SFunctionField struct { - fields []IQueryField - function string - alias string +type IFunction interface { + expression() string } -func (ff *SFunctionField) Expression() string { - fieldRefs := make([]interface{}, 0) - for _, f := range ff.fields { - fieldRefs = append(fieldRefs, f.Reference()) +type SFunctionFieldBase struct { + IFunction + alias string +} + +func (ff *SFunctionFieldBase) Reference() string { + if len(ff.alias) == 0 { + log.Warningf("reference a function field without alias! %s", ff.expression()) + return ff.expression() + } else { + return fmt.Sprintf("`%s`", ff.alias) } - return fmt.Sprintf("%s AS `%s`", fmt.Sprintf(ff.function, fieldRefs...), ff.Name()) } -func (ff *SFunctionField) Name() string { - return ff.alias +func (ff *SFunctionFieldBase) Expression() string { + if len(ff.alias) > 0 { + // add alias + return fmt.Sprintf("%s AS `%s`", ff.expression(), ff.alias) + } else { + // no alias + return ff.expression() + } } -func (ff *SFunctionField) Reference() string { - return ff.alias +func (ff *SFunctionFieldBase) Name() string { + if len(ff.alias) > 0 { + return ff.alias + } else { + return ff.expression() + } } -func (ff *SFunctionField) Label(label string) IQueryField { +func (ff *SFunctionFieldBase) Label(label string) IQueryField { if len(label) > 0 && label != ff.alias { ff.alias = label } return ff } -type SFunctionFieldWithoutAlias struct { +type SExprFunction struct { fields []IQueryField function string } -func (ff *SFunctionFieldWithoutAlias) Expression() string { +func (ff *SExprFunction) expression() string { fieldRefs := make([]interface{}, 0) for _, f := range ff.fields { fieldRefs = append(fieldRefs, f.Reference()) @@ -62,26 +78,14 @@ func (ff *SFunctionFieldWithoutAlias) Expression() string { return fmt.Sprintf(ff.function, fieldRefs...) } -func (ff *SFunctionFieldWithoutAlias) Name() string { - return ff.Expression() -} - -func (ff *SFunctionFieldWithoutAlias) Reference() string { - return ff.Expression() -} - -func (ff *SFunctionFieldWithoutAlias) Label(label string) IQueryField { - if len(label) > 0 { - return &SFunctionField{ff.fields, ff.function, label} - } - return ff -} - func NewFunctionField(name string, funcexp string, fields ...IQueryField) IQueryField { - if len(name) > 0 { - return &SFunctionField{function: funcexp, alias: name, fields: fields} - } else { - return &SFunctionFieldWithoutAlias{fields: fields, function: funcexp} + funcBase := &SExprFunction{ + fields: fields, + function: funcexp, + } + return &SFunctionFieldBase{ + IFunction: funcBase, + alias: name, } } diff --git a/vendor/yunion.io/x/sqlchemy/query.go b/vendor/yunion.io/x/sqlchemy/query.go index 6de4aec22d..c5fd2c5ce6 100644 --- a/vendor/yunion.io/x/sqlchemy/query.go +++ b/vendor/yunion.io/x/sqlchemy/query.go @@ -516,6 +516,10 @@ func (tq *SQuery) findField(name string) IQueryField { func (tq *SQuery) internalFindField(name string) IQueryField { for _, f := range tq.fields { if f.Name() == name { + // switch f.(type) { + // case *SFunctionFieldBase: + // log.Warningf("cannot directly reference a function alias, should use Subquery() to enclose the query") + // } return f } }