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 {
bun.BaseModel `bun:"table:end_user_detail,alias:eud"`
CreatedAndModified `bun:",extend"`
CreatedAndModified `bun:"extend"`
ReportId string `bun:",pk,notnull" json:"reportId"`
ParkId string `bun:",pk,notnull" json:"parkId"`
MeterId string `bun:"meter_04kv_id,pk,notnull" json:"meterId"`

View File

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

View File

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

View File

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

View File

@ -15,7 +15,7 @@ const (
type Report struct {
bun.BaseModel `bun:"table:report,alias:r"`
CreatedAndModified `bun:"extends"`
CreatedAndModified `bun:"extend"`
Id string `bun:",pk,notnull" json:"id"`
ParkId string `bun:",notnull" json:"parkId"`
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 {
Created `bun:",extend"`
Created `bun:"extend"`
CreatedBy *string `json:"createdBy"`
}
@ -16,17 +16,17 @@ type Deleted struct {
}
type DeletedWithUser struct {
Deleted `bun:",extend"`
Deleted `bun:"extend"`
DeletedBy *string `json:"deletedBy"`
}
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"`
}
type CreatedAndModifiedWithUser struct {
CreatedAndModified `bun:",extend"`
CreatedAndModified `bun:"extend"`
CreatedBy *string `json:"createdBy"`
LastModifiedBy *string `json:"lastModifiedBy"`
}

View File

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

View File

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

View File

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

View File

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