test

package
v0.0.0-...-2ae295b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 22, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Customer

type Customer struct {
	CustomerName string `gorm:"column:CUSTOMER_NAME" json:"customer_name"`
	// use go_ora.NVarChar/go_ora.NClob for NVARCHAR/NCLOB columns
	Address     go_ora.NVarChar `gorm:"column:ADDRESS" json:"address"`
	City        string          `gorm:"column:CITY" json:"city"`
	State       string          `gorm:"column:STATE" json:"state"`
	ZipCode     string          `gorm:"column:ZIP_CODE" json:"zip_code"`
	CreatedTime time.Time       `gorm:"column:CREATED_TIME" json:"created_time"`
	Age         int32           `gorm:"column:AGE" json:"age"`
	// test case: the returning column `autoIncrement` is at the end
	CustomerID int64 `gorm:"column:CUSTOMER_ID;sequence:CUSTOMERS_S;autoIncrement" json:"customer_id"`
}

/-------Auto returning auto-generated sequence--------------------------------------------------------------- Customer table comment - use `autoIncrement` to specify the auto generated sequence value.

func (Customer) GetCustomerID

func (c Customer) GetCustomerID() int64

func (*Customer) TableName

func (c *Customer) TableName() string

TableName sets the insert table name for this struct type

type CustomerOfNClob

type CustomerOfNClob struct {
	CustomerID   int64  `gorm:"column:CUSTOMER_ID;sequence:CUSTOMERS_S;autoIncrement" json:"customer_id"`
	CustomerName string `gorm:"column:CUSTOMER_NAME" json:"customer_name"`
	// use go_ora.NVarChar/go_ora.NClob for NVARCHAR/NCLOB columns
	Address     *go_ora.NClob `gorm:"column:ADDRESS;type:nclob" json:"address"`
	City        string        `gorm:"column:CITY" json:"city"`
	State       string        `gorm:"column:STATE" json:"state"`
	ZipCode     string        `gorm:"column:ZIP_CODE" json:"zip_code"`
	CreatedTime time.Time     `gorm:"column:CREATED_TIME" json:"created_time"`
	Age         int32         `gorm:"column:AGE" json:"age"`
}

/--------go_ora.NVarChar/go_ora.NClob for NCLOB columns-------------------------------------------------------- CustomerOfNClob table comment use `type` for go_ora.NClob

func (CustomerOfNClob) GetCustomerID

func (c CustomerOfNClob) GetCustomerID() int64

func (*CustomerOfNClob) TableName

func (c *CustomerOfNClob) TableName() string

TableName sets the insert table name for this struct type

type CustomerOfUDT

type CustomerOfUDT struct {
	CustomerName string `gorm:"column:CUSTOMER_NAME" json:"customer_name"`
	// Address      string       `gorm:"column:ADDRESS" json:"address"`
	Address     *NClobContent `gorm:"column:ADDRESS" json:"address"`
	City        string        `gorm:"column:CITY" json:"city"`
	State       string        `gorm:"column:STATE" json:"state"`
	ZipCode     string        `gorm:"column:ZIP_CODE" json:"zip_code"`
	CreatedTime time.Time     `gorm:"column:CREATED_TIME" json:"created_time"`
	Age         int32         `gorm:"column:AGE" json:"age"`
	// test case: the returning column `autoIncrement` is at the end
	CustomerID int64 `gorm:"column:CUSTOMER_ID;sequence:CUSTOMERS_S;autoIncrement" json:"customer_id"`
}

/---------------------------------------------------------------------- CustomerOfUDT table comment

func (*CustomerOfUDT) TableName

func (c *CustomerOfUDT) TableName() string

TableName sets the insert table name for this struct type

type CustomerWithHook

type CustomerWithHook struct {
	CustomerName string `gorm:"column:CUSTOMER_NAME" json:"customer_name"`
	// test case: the sequence column is not the first
	CustomerID  int64           `gorm:"column:CUSTOMER_ID;sequence:CUSTOMERS_S" json:"customer_id"`
	Address     go_ora.NVarChar `gorm:"column:ADDRESS" json:"address"`
	City        string          `gorm:"column:CITY" json:"city"`
	State       string          `gorm:"column:STATE" json:"state"`
	ZipCode     string          `gorm:"column:ZIP_CODE" json:"zip_code"`
	CreatedTime time.Time       `gorm:"column:CREATED_TIME" json:"created_time"`
	Age         int32           `gorm:"column:AGE" json:"age"`
}

/----Customer callbacks------------------------------------------------------------------ CustomerWithHook table comment

func (*CustomerWithHook) BeforeCreate

func (c *CustomerWithHook) BeforeCreate(tx *gorm.DB) (err error)

func (*CustomerWithHook) TableName

func (c *CustomerWithHook) TableName() string

TableName sets the insert table name for this struct type

type CustomerWithPrimaryKey

type CustomerWithPrimaryKey struct {
	CustomerName string          `gorm:"column:CUSTOMER_NAME" json:"customer_name"`
	Address      go_ora.NVarChar `gorm:"column:ADDRESS" json:"address"`
	City         string          `gorm:"column:CITY" json:"city"`
	State        string          `gorm:"column:STATE" json:"state"`
	ZipCode      string          `gorm:"column:ZIP_CODE" json:"zip_code"`
	CreatedTime  time.Time       `gorm:"column:CREATED_TIME" json:"created_time"`
	Age          int32           `gorm:"column:AGE" json:"age"`
	// test case: the returning column `autoIncrement` is at the end
	CustomerID int64 `gorm:"column:CUSTOMER_ID;sequence:CUSTOMERS_S;autoIncrement;primaryKey" json:"customer_id"`
}

CustomerWithPrimaryKey table comment - use `primaryKey` to create WHERE condition.

func (*CustomerWithPrimaryKey) TableName

func (c *CustomerWithPrimaryKey) TableName() string

TableName sets the insert table name for this struct type

type CustomerWithSequenceButNotReturning

type CustomerWithSequenceButNotReturning struct {
	CustomerName string `gorm:"column:CUSTOMER_NAME" json:"customer_name"`
	// test case: the sequence column is not the first one
	CustomerID int64 `gorm:"column:CUSTOMER_ID;sequence:CUSTOMERS_S" json:"customer_id"`
	// use go_ora.NVarChar/go_ora.NClob for NVARCHAR/NCLOB columns
	Address     go_ora.NVarChar `gorm:"column:ADDRESS" json:"address"`
	City        string          `gorm:"column:CITY" json:"city"`
	State       string          `gorm:"column:STATE" json:"state"`
	ZipCode     string          `gorm:"column:ZIP_CODE" json:"zip_code"`
	CreatedTime time.Time       `gorm:"column:CREATED_TIME" json:"created_time"`
	Age         int32           `gorm:"column:AGE" json:"age"`
}

/------Generate sequence(autoIncrement value)---------------------------------------------------------------- CustomerWithSequenceButNotReturning table comment - use `sequence` to specify the sequence name. - need db.Clauses(clause.Returning{...}) to return new value of sequence column.

func (*CustomerWithSequenceButNotReturning) TableName

TableName sets the insert table name for this struct type

type NClobContent

type NClobContent struct {
	String go_ora.NClob
}

func (*NClobContent) GormValue

func (c *NClobContent) GormValue(ctx context.Context, db *gorm.DB) clause.Expr

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL