Django Model 2 Go Struct
for gorm or other ORM operation.
Depends in go code:
https://github.com/jinzhu/gorm
https://github.com/guregu/null
Install
git clone /django2go.git
cd django2go
python setup.py install .
Usage:
settings.py
INSTALLED_APPS = [
...
'django2go',
...
]
run CMD:
python manage.py model2go app_name
Example generated go code: testapp.go
python manage.py model2go app_name --use_column_name To use database column name.
Django model:
class Model1(models.Model):
field1 = models.CharField(max_length=200)
field_with_under_score = models.IntegerField()
fieldWithUpperCase = models.IntegerField()
fieldWith_Case = models.IntegerField()
Generated go struct:
type Model2 struct {
Id int64 `json:"id" gorm:"primary_key"`
Field1 string `json:"field1"`
FieldWithUnderScore int64 `json:"field_with_under_score"`
Fieldwithuppercase int64 `json:"fieldWithUpperCase"`
FieldwithCase int64 `json:"fieldWith_Case"`
}
// TableName 使用指定的数据库表名
func (Model2) TableName() string {
return TABLE_PREFIX + "model2"
}
Metadata
Release files for django2go 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| django2go-0.1.3.tar.gz | 5.8 kB | Without provenance | Details |
Release files / django2go-0.1.3.tar.gz
| Download URL | django2go-0.1.3.tar.gz |
|---|---|
| Size | 5.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
70b8ae00a0cf65645807e144499724741c2efc9c11c77b1b07332b536503ecf5
|
|
BLAKE2b-256 checksum How to use checksums |
b2bfe01d803d6c73e514feb557de2e8517240d745a527e39f5173014c36dbaff
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.4
|
Security for django2go 0.1.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.