fix(model):修正模型定义中的继承部分。

This commit is contained in:
徐涛 2022-09-18 10:11:23 +08:00
parent 9bbb58ae55
commit 0d062560da
10 changed files with 22 additions and 22 deletions

View File

@ -9,7 +9,7 @@ import (
type EndUserDetail struct { type EndUserDetail struct {
bun.BaseModel `bun:"table:end_user_detail,alias:eud"` bun.BaseModel `bun:"table:end_user_detail,alias:eud"`
CreatedAndModified `bun:",extend"` CreatedAndModified `bun:"extend"`
ReportId string `bun:",pk,notnull" json:"reportId"` ReportId string `bun:",pk,notnull" json:"reportId"`
ParkId string `bun:",pk,notnull" json:"parkId"` ParkId string `bun:",pk,notnull" json:"parkId"`
MeterId string `bun:"meter_04kv_id,pk,notnull" json:"meterId"` MeterId string `bun:"meter_04kv_id,pk,notnull" json:"meterId"`

View File

@ -7,8 +7,8 @@ import (
type MaintenanceFee struct { type MaintenanceFee struct {
bun.BaseModel `bun:"table:maintenance_fee,alias:m"` bun.BaseModel `bun:"table:maintenance_fee,alias:m"`
CreatedAndModified `bun:",extend"` CreatedAndModified `bun:"extend"`
Deleted `bun:",extend"` Deleted `bun:"extend"`
Id string `bun:",pk,notnull" json:"id"` Id string `bun:",pk,notnull" json:"id"`
ParkId string `bun:",notnull" json:"parkId"` ParkId string `bun:",notnull" json:"parkId"`
Name string `bun:",notnull" json:"name"` Name string `bun:",notnull" json:"name"`

View File

@ -7,7 +7,7 @@ import (
type Meter04KV struct { type Meter04KV struct {
bun.BaseModel `bun:"table:meter_04kv,alias:mt"` bun.BaseModel `bun:"table:meter_04kv,alias:mt"`
CreatedAndModified `bun:",extend"` CreatedAndModified `bun:"extend"`
Code string `bun:",pk,notnull" json:"code" excel:"code"` Code string `bun:",pk,notnull" json:"code" excel:"code"`
ParkId string `bun:",pk,notnull" json:"parkId"` ParkId string `bun:",pk,notnull" json:"parkId"`
Address *string `json:"address" excel:"address"` Address *string `json:"address" excel:"address"`

View File

@ -21,8 +21,8 @@ const (
type Park struct { type Park struct {
bun.BaseModel `bun:"table:park,alias:p"` bun.BaseModel `bun:"table:park,alias:p"`
CreatedAndModified `bun:",extend"` CreatedAndModified `bun:"extend"`
Deleted `bun:",extend"` Deleted `bun:"extend"`
Id string `bun:",pk,notnull" json:"id"` Id string `bun:",pk,notnull" json:"id"`
UserId string `bun:",notnull" json:"userId"` UserId string `bun:",notnull" json:"userId"`
Name string `bun:",notnull" json:"name"` Name string `bun:",notnull" json:"name"`

View File

@ -15,7 +15,7 @@ const (
type Report struct { type Report struct {
bun.BaseModel `bun:"table:report,alias:r"` bun.BaseModel `bun:"table:report,alias:r"`
CreatedAndModified `bun:"extends"` CreatedAndModified `bun:"extend"`
Id string `bun:",pk,notnull" json:"id"` Id string `bun:",pk,notnull" json:"id"`
ParkId string `bun:",notnull" json:"parkId"` ParkId string `bun:",notnull" json:"parkId"`
Period time.Time `bun:"type:date,notnull" json:"period" time_format:"simple_date" time_location:"shanghai"` Period time.Time `bun:"type:date,notnull" json:"period" time_format:"simple_date" time_location:"shanghai"`

View File

@ -7,7 +7,7 @@ type Created struct {
} }
type CreatedWithUser struct { type CreatedWithUser struct {
Created `bun:",extend"` Created `bun:"extend"`
CreatedBy *string `json:"createdBy"` CreatedBy *string `json:"createdBy"`
} }
@ -16,17 +16,17 @@ type Deleted struct {
} }
type DeletedWithUser struct { type DeletedWithUser struct {
Deleted `bun:",extend"` Deleted `bun:"extend"`
DeletedBy *string `json:"deletedBy"` DeletedBy *string `json:"deletedBy"`
} }
type CreatedAndModified struct { type CreatedAndModified struct {
Created `bun:",extend"` Created `bun:"extend"`
LastModifiedAt *time.Time `bun:"type:timestamptz,nullzero,default:current_timestamp" json:"lastModifiedAt" time_format:"simple_datetime" time_location:"shanghai"` LastModifiedAt *time.Time `bun:"type:timestamptz,nullzero,default:current_timestamp" json:"lastModifiedAt" time_format:"simple_datetime" time_location:"shanghai"`
} }
type CreatedAndModifiedWithUser struct { type CreatedAndModifiedWithUser struct {
CreatedAndModified `bun:",extend"` CreatedAndModified `bun:"extend"`
CreatedBy *string `json:"createdBy"` CreatedBy *string `json:"createdBy"`
LastModifiedBy *string `json:"lastModifiedBy"` LastModifiedBy *string `json:"lastModifiedBy"`
} }

View File

@ -10,7 +10,7 @@ const (
type User struct { type User struct {
bun.BaseModel `bun:"table:user,alias:u"` bun.BaseModel `bun:"table:user,alias:u"`
Created `bun:",extend"` Created `bun:"extend"`
Id string `bun:",pk,notnull" json:"id"` Id string `bun:",pk,notnull" json:"id"`
Username string `bun:",notnull" json:"username"` Username string `bun:",notnull" json:"username"`
Password string `bun:",notnull" json:"-"` Password string `bun:",notnull" json:"-"`
@ -23,7 +23,7 @@ type User struct {
type UserWithCredentials struct { type UserWithCredentials struct {
bun.BaseModel `bun:"table:user,alias:u"` bun.BaseModel `bun:"table:user,alias:u"`
Created `bun:",extend"` Created `bun:"extend"`
Id string `bun:",pk,notnull" json:"id"` Id string `bun:",pk,notnull" json:"id"`
Username string `bun:",notnull" json:"username"` Username string `bun:",notnull" json:"username"`
Password string `bun:",notnull" json:"credential"` Password string `bun:",notnull" json:"credential"`

View File

@ -9,7 +9,7 @@ import (
type UserCharge struct { type UserCharge struct {
bun.BaseModel `bun:"table:user_charge,alias:c"` bun.BaseModel `bun:"table:user_charge,alias:c"`
Created `bun:"extends"` Created `bun:"extend"`
Seq int64 `bun:"type:bigint,pk,notnull,autoincrement" json:"seq"` Seq int64 `bun:"type:bigint,pk,notnull,autoincrement" json:"seq"`
UserId string `bun:",notnull" json:"userId"` UserId string `bun:",notnull" json:"userId"`
Fee decimal.NullDecimal `json:"fee"` Fee decimal.NullDecimal `json:"fee"`
@ -26,6 +26,6 @@ type UserCharge struct {
} }
type ChargeWithName struct { type ChargeWithName struct {
UserDetail `bun:"extends"` UserDetail `bun:"extend"`
UserCharge `bun:"extends"` UserCharge `bun:"extend"`
} }

View File

@ -10,8 +10,8 @@ import (
type UserDetail struct { type UserDetail struct {
bun.BaseModel `bun:"table:user_detail,alias:d"` bun.BaseModel `bun:"table:user_detail,alias:d"`
CreatedAndModifiedWithUser `bun:",extend"` CreatedAndModifiedWithUser `bun:"extend"`
DeletedWithUser `bun:",extend"` DeletedWithUser `bun:"extend"`
Id string `bun:",pk,notnull" json:"-"` Id string `bun:",pk,notnull" json:"-"`
Name *string `json:"name"` Name *string `json:"name"`
Abbr *string `json:"abbr"` Abbr *string `json:"abbr"`
@ -24,7 +24,7 @@ type UserDetail struct {
} }
type JoinedUserDetail struct { type JoinedUserDetail struct {
UserDetail `bun:"extends"` UserDetail `bun:"extend"`
Id string `json:"id"` Id string `json:"id"`
Username string `json:"username"` Username string `json:"username"`
Type int8 `json:"type"` Type int8 `json:"type"`
@ -32,8 +32,8 @@ type JoinedUserDetail struct {
} }
type FullJoinedUserDetail struct { type FullJoinedUserDetail struct {
UserDetail `bun:"extends"` UserDetail `bun:"extend"`
User `bun:"extends"` User `bun:"extend"`
} }
type UserDetailSimplified struct { type UserDetailSimplified struct {

View File

@ -7,7 +7,7 @@ import (
type WillDilutedFee struct { type WillDilutedFee struct {
bun.BaseModel `bun:"table:will_diluted_fee,alias:w"` bun.BaseModel `bun:"table:will_diluted_fee,alias:w"`
CreatedAndModified `bun:"extends"` CreatedAndModified `bun:"extend"`
Id string `bun:",pk,notnull" json:"diluteId"` Id string `bun:",pk,notnull" json:"diluteId"`
ReportId string `bun:",notnull" json:"reportId"` ReportId string `bun:",notnull" json:"reportId"`
SourceId *string `json:"sourceId"` SourceId *string `json:"sourceId"`