Documentation
¶
Index ¶
- Constants
- Variables
- type CodeGenerator
- type Condition
- type ConditionsGenerator
- type Field
- type File
- type GormTag
- type GormTags
- type JenParam
- func (param JenParam) GenericType() *jen.Statement
- func (param *JenParam) SQLToBasicType(typeV Type)
- func (param *JenParam) ToBasicKind(basicType *types.Basic)
- func (param *JenParam) ToBool()
- func (param JenParam) ToCustomType(destPkg string, typeV Type)
- func (param *JenParam) ToSlice()
- func (param *JenParam) ToString()
- type RelationGettersGenerator
- type Type
Constants ¶
View Source
const (
DestPackageKey = "dest_package"
)
Variables ¶
View Source
var ErrFkNotInTypeFields = errors.New("fk not in type's fields")
View Source
var GenConditionsCmd = verdeter.BuildVerdeterCommand(verdeter.VerdeterConfig{ Use: "conditions", Short: "Generate conditions to query your objects using badaas-orm", Long: `gen is the command you can use to generate the files and configurations necessary for your project to use BadAss in a simple way.`, Run: generateConditions, Args: cobra.MinimumNArgs(1), })
Functions ¶
This section is empty.
Types ¶
type CodeGenerator ¶
type Condition ¶
type ConditionsGenerator ¶
type ConditionsGenerator struct {
// contains filtered or unexported fields
}
func NewConditionsGenerator ¶
func NewConditionsGenerator(object types.Object) *ConditionsGenerator
func (ConditionsGenerator) ForEachField ¶
func (cg ConditionsGenerator) ForEachField(file *File, fields []Field) []Condition
Generate the conditions for each of the object's fields
func (ConditionsGenerator) Into ¶
func (cg ConditionsGenerator) Into(file *File) error
Add conditions for an object in the file
type Field ¶
type Field struct { Name string NamePrefix string Type Type Embedded bool Tags GormTags ColumnPrefix string }
func (Field) ChangeType ¶
Create a new field with the same name and tags but a different type
func (Field) CompleteName ¶
func (Field) TypeString ¶
Get field's type full string (pkg + name)
type JenParam ¶
type JenParam struct {
// contains filtered or unexported fields
}
func NewJenParam ¶
func NewJenParam() *JenParam
func (JenParam) GenericType ¶
func (*JenParam) SQLToBasicType ¶
func (*JenParam) ToBasicKind ¶
func (JenParam) ToCustomType ¶
type RelationGettersGenerator ¶
type RelationGettersGenerator struct {
// contains filtered or unexported fields
}
func NewRelationGettersGenerator ¶
func NewRelationGettersGenerator(object types.Object) *RelationGettersGenerator
func (RelationGettersGenerator) ForEachField ¶
func (generator RelationGettersGenerator) ForEachField(file *File, fields []Field) []jen.Code
func (RelationGettersGenerator) Into ¶
func (generator RelationGettersGenerator) Into(file *File) error
Add conditions for an object in the file
type Type ¶
func (Type) BadaasModelStruct ¶
Get the struct under type if it is a Badaas model Returns error if the type is not a Badaas model
func (Type) GetFK ¶
Returns the fk field of the type to the "field"'s object (another field that references that object)
func (Type) IsGormCustomType ¶
Returns true if the type is a Gorm Custom type (https://gorm.io/docs/data_types.html)
func (Type) IsSQLNullableType ¶
Returns true if the type is a sql nullable type (sql.NullBool, sql.NullInt, etc.)
Source Files
¶
Directories
¶
Path | Synopsis |
---|---|
tests
|
|
belongsto
Code generated by badaas-cli v0.0.0, DO NOT EDIT.
|
Code generated by badaas-cli v0.0.0, DO NOT EDIT. |
hasmany
Code generated by badaas-cli v0.0.0, DO NOT EDIT.
|
Code generated by badaas-cli v0.0.0, DO NOT EDIT. |
hasmanywithpointers
Code generated by badaas-cli v0.0.0, DO NOT EDIT.
|
Code generated by badaas-cli v0.0.0, DO NOT EDIT. |
hasone
Code generated by badaas-cli v0.0.0, DO NOT EDIT.
|
Code generated by badaas-cli v0.0.0, DO NOT EDIT. |
multiplepackage/package1
Code generated by badaas-cli v0.0.0, DO NOT EDIT.
|
Code generated by badaas-cli v0.0.0, DO NOT EDIT. |
overrideforeignkey
Code generated by badaas-cli v0.0.0, DO NOT EDIT.
|
Code generated by badaas-cli v0.0.0, DO NOT EDIT. |
overrideforeignkeyinverse
Code generated by badaas-cli v0.0.0, DO NOT EDIT.
|
Code generated by badaas-cli v0.0.0, DO NOT EDIT. |
overridereferences
Code generated by badaas-cli v0.0.0, DO NOT EDIT.
|
Code generated by badaas-cli v0.0.0, DO NOT EDIT. |
overridereferencesinverse
Code generated by badaas-cli v0.0.0, DO NOT EDIT.
|
Code generated by badaas-cli v0.0.0, DO NOT EDIT. |
results
Code generated by badaas-cli v0.0.0, DO NOT EDIT.
|
Code generated by badaas-cli v0.0.0, DO NOT EDIT. |
selfreferential
Code generated by badaas-cli v0.0.0, DO NOT EDIT.
|
Code generated by badaas-cli v0.0.0, DO NOT EDIT. |
Click to show internal directories.
Click to hide internal directories.