Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
张磊
/
FileStorageBeego
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
618cbf1e
authored
2013-08-16 22:24:10 +0800
by
slene
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
orm string type default will use varchar(255)
1 parent
c81bbf98
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
7 deletions
orm/models_info_f.go
orm/models_test.go
orm/models_utils.go
orm/models_info_f.go
View file @
618cbf1
...
...
@@ -206,8 +206,8 @@ checkType:
if
err
!=
nil
{
goto
end
}
if
fieldType
==
Type
TextField
&&
size
!=
"
"
{
fieldType
=
Type
Char
Field
if
fieldType
==
Type
CharField
&&
tags
[
"type"
]
==
"text
"
{
fieldType
=
Type
Text
Field
}
if
fieldType
==
TypeFloatField
&&
(
digits
!=
""
||
decimals
!=
""
)
{
fieldType
=
TypeDecimalField
...
...
@@ -312,7 +312,7 @@ checkType:
fi
.
size
=
int
(
v
)
}
}
else
{
err
=
fmt
.
Errorf
(
"size must be specify"
)
fi
.
size
=
255
}
case
TypeTextField
:
fi
.
index
=
false
...
...
orm/models_test.go
View file @
618cbf1
...
...
@@ -15,7 +15,7 @@ import (
type
Data
struct
{
Id
int
Boolean
bool
Char
string
`orm:
size(50)
`
Char
string
`orm:
"size(50)"
`
Text
string
`orm:"type(text)"`
Date
time
.
Time
`orm:"type(date)"`
DateTime
time
.
Time
...
...
@@ -100,7 +100,7 @@ type Post struct {
Id
int
User
*
User
`orm:"rel(fk)"`
Title
string
`orm:"size(60)"`
Content
string
``
Content
string
`
orm:"type(text)"
`
Created
time
.
Time
`orm:"auto_now_add"`
Updated
time
.
Time
`orm:"auto_now"`
Tags
[]
*
Tag
`orm:"rel(m2m)"`
...
...
@@ -125,7 +125,7 @@ func NewTag() *Tag {
type
Comment
struct
{
Id
int
Post
*
Post
`orm:"rel(fk)"`
Content
string
``
Content
string
`
orm:"type(text)"
`
Parent
*
Comment
`orm:"null;rel(fk)"`
Created
time
.
Time
`orm:"auto_now_add"`
}
...
...
orm/models_utils.go
View file @
618cbf1
...
...
@@ -64,7 +64,7 @@ func getFieldType(val reflect.Value) (ft int, err error) {
case
reflect
.
Bool
:
ft
=
TypeBooleanField
case
reflect
.
String
:
ft
=
Type
Text
Field
ft
=
Type
Char
Field
case
reflect
.
Invalid
:
default
:
if
elm
.
CanInterface
()
{
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment