Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Get ¶
func Get[T any](v *T) T
Get removes the pointer used when [goe.Select] get any argument.
Example ¶
for row, err := range goe.Select(&struct {
User *string //goe needs a pointer for store the referecent argument
Role *string //goe needs a pointer for store the referecent argument
EndTime **time.Time //if the argument is already a pointer goe needs a pointer to a pointer for store the referecent argument
}{
User: &db.User.Name,
Role: &db.Role.Name,
EndTime: &db.UserRole.EndDate,
}).
From(db.User).
Joins(
join.LeftJoin[int](&db.User.Id, &db.UserRole.UserId),
join.LeftJoin[int](&db.UserRole.RoleId, &db.Role.Id),
).
OrderByAsc(&db.User.Id).Rows() {
q = append(q, struct {
User string //return model can be different from select model
Role string
EndTime *time.Time
}{
User: query.Get(row.User), //get a empty string if the database returns null
Role: query.Get(row.Role), //get a empty string if the database returns null
EndTime: query.Get(row.EndTime), //EndTime can store nil/null values
})
}
Types ¶
type Function ¶
type Function[T any] struct { Field *T Type enum.FunctionType Value T }
func (Function[T]) GetType ¶
func (f Function[T]) GetType() enum.FunctionType
Click to show internal directories.
Click to hide internal directories.