// Code generated by goctl. DO NOT EDIT. package model import ( "context" "database/sql" "fmt" "strings" "time" "github.com/zeromicro/go-zero/core/stores/builder" "github.com/zeromicro/go-zero/core/stores/sqlc" "github.com/zeromicro/go-zero/core/stores/sqlx" "github.com/zeromicro/go-zero/core/stringx" ) var ( teThoroughlyRegisterFieldNames = builder.RawFieldNames(&TeThoroughlyRegister{}, true) teThoroughlyRegisterRows = strings.Join(teThoroughlyRegisterFieldNames, ",") teThoroughlyRegisterRowsExpectAutoSet = strings.Join(stringx.Remove(teThoroughlyRegisterFieldNames), ",") teThoroughlyRegisterRowsWithPlaceHolder = builder.PostgreSqlJoin(stringx.Remove(teThoroughlyRegisterFieldNames, "id")) ) type ( teThoroughlyRegisterModel interface { Insert(ctx context.Context, data *TeThoroughlyRegister) (sql.Result, error) FindOne(ctx context.Context, id string) (*TeThoroughlyRegister, error) Update(ctx context.Context, data *TeThoroughlyRegister) error Delete(ctx context.Context, id string) error } defaultTeThoroughlyRegisterModel struct { conn sqlx.SqlConn table string } TeThoroughlyRegister struct { Id string `db:"id"` PlanId string `db:"plan_id"` Name string `db:"name"` Sex string `db:"sex"` CardType string `db:"card_type"` IdCard string `db:"id_card"` IdCardSensitive string `db:"id_card_sensitive"` Birthday time.Time `db:"birthday"` Nation string `db:"nation"` Country string `db:"country"` State int64 `db:"state"` RegisteredResidence string `db:"registered_residence"` DistrictCode string `db:"district_code"` District string `db:"district"` StudentType string `db:"student_type"` Address string `db:"address"` RegisteredType string `db:"registered_type"` NoHouse string `db:"no_house"` FamilyStatus string `db:"family_status"` Year int64 `db:"year"` RegisterCode string `db:"register_code"` CreatedBy string `db:"created_by"` CreatedAt time.Time `db:"created_at"` UpdatedBy string `db:"updated_by"` UpdatedAt time.Time `db:"updated_at"` Deleted bool `db:"deleted"` AccountId string `db:"account_id"` HouseType string `db:"house_type"` NativePlace string `db:"native_place"` Kindergarten string `db:"kindergarten"` SchoolId string `db:"school_id"` SchoolName string `db:"school_name"` HighwayId string `db:"highway_id"` RoadNumberId string `db:"road_number_id"` BloodType string `db:"blood_type"` OnlyChild bool `db:"only_child"` BirthPlace string `db:"birth_place"` HealthCondition string `db:"health_condition"` Speciality string `db:"speciality"` FillSource string `db:"fill_source"` AreaId string `db:"area_id"` SingleParent bool `db:"single_parent"` HighwayName string `db:"highway_name"` RoadNumberName string `db:"road_number_name"` GuardianPermit1 int64 `db:"guardian_permit1"` GuardianPermit2 int64 `db:"guardian_permit2"` IdCardFile string `db:"id_card_file"` FillPhone string `db:"fill_phone"` LocationOther bool `db:"location_other"` CityHouse bool `db:"city_house"` IsWuming bool `db:"is_wuming"` DeleteAt int64 `db:"delete_at"` } ) func newTeThoroughlyRegisterModel(conn sqlx.SqlConn) *defaultTeThoroughlyRegisterModel { return &defaultTeThoroughlyRegisterModel{ conn: conn, table: `"public"."te_thoroughly_register"`, } } func (m *defaultTeThoroughlyRegisterModel) withSession(session sqlx.Session) *defaultTeThoroughlyRegisterModel { return &defaultTeThoroughlyRegisterModel{ conn: sqlx.NewSqlConnFromSession(session), table: `"public"."te_thoroughly_register"`, } } func (m *defaultTeThoroughlyRegisterModel) Delete(ctx context.Context, id string) error { query := fmt.Sprintf("delete from %s where id = $1", m.table) _, err := m.conn.ExecCtx(ctx, query, id) return err } func (m *defaultTeThoroughlyRegisterModel) FindOne(ctx context.Context, id string) (*TeThoroughlyRegister, error) { query := fmt.Sprintf("select %s from %s where id = $1 limit 1", teThoroughlyRegisterRows, m.table) var resp TeThoroughlyRegister err := m.conn.QueryRowCtx(ctx, &resp, query, id) switch err { case nil: return &resp, nil case sqlc.ErrNotFound: return nil, ErrNotFound default: return nil, err } } func (m *defaultTeThoroughlyRegisterModel) Insert(ctx context.Context, data *TeThoroughlyRegister) (sql.Result, error) { query := fmt.Sprintf("insert into %s (%s) values ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20, $21, $22, $23, $24, $25, $26, $27, $28, $29, $30, $31, $32, $33, $34, $35, $36, $37, $38, $39, $40, $41, $42, $43, $44, $45, $46, $47, $48, $49, $50, $51, $52)", m.table, teThoroughlyRegisterRowsExpectAutoSet) ret, err := m.conn.ExecCtx(ctx, query, data.Id, data.PlanId, data.Name, data.Sex, data.CardType, data.IdCard, data.IdCardSensitive, data.Birthday, data.Nation, data.Country, data.State, data.RegisteredResidence, data.DistrictCode, data.District, data.StudentType, data.Address, data.RegisteredType, data.NoHouse, data.FamilyStatus, data.Year, data.RegisterCode, data.CreatedBy, data.CreatedAt, data.UpdatedBy, data.UpdatedAt, data.Deleted, data.AccountId, data.HouseType, data.NativePlace, data.Kindergarten, data.SchoolId, data.SchoolName, data.HighwayId, data.RoadNumberId, data.BloodType, data.OnlyChild, data.BirthPlace, data.HealthCondition, data.Speciality, data.FillSource, data.AreaId, data.SingleParent, data.HighwayName, data.RoadNumberName, data.GuardianPermit1, data.GuardianPermit2, data.IdCardFile, data.FillPhone, data.LocationOther, data.CityHouse, data.IsWuming, data.DeleteAt) return ret, err } func (m *defaultTeThoroughlyRegisterModel) Update(ctx context.Context, data *TeThoroughlyRegister) error { query := fmt.Sprintf("update %s set %s where id = $1", m.table, teThoroughlyRegisterRowsWithPlaceHolder) _, err := m.conn.ExecCtx(ctx, query, data.Id, data.PlanId, data.Name, data.Sex, data.CardType, data.IdCard, data.IdCardSensitive, data.Birthday, data.Nation, data.Country, data.State, data.RegisteredResidence, data.DistrictCode, data.District, data.StudentType, data.Address, data.RegisteredType, data.NoHouse, data.FamilyStatus, data.Year, data.RegisterCode, data.CreatedBy, data.CreatedAt, data.UpdatedBy, data.UpdatedAt, data.Deleted, data.AccountId, data.HouseType, data.NativePlace, data.Kindergarten, data.SchoolId, data.SchoolName, data.HighwayId, data.RoadNumberId, data.BloodType, data.OnlyChild, data.BirthPlace, data.HealthCondition, data.Speciality, data.FillSource, data.AreaId, data.SingleParent, data.HighwayName, data.RoadNumberName, data.GuardianPermit1, data.GuardianPermit2, data.IdCardFile, data.FillPhone, data.LocationOther, data.CityHouse, data.IsWuming, data.DeleteAt) return err } func (m *defaultTeThoroughlyRegisterModel) tableName() string { return m.table }