mirror of
https://github.com/PretendoNetwork/super-mario-maker.git
synced 2026-09-11 18:37:37 -05:00
Merge pull request #20 from TraceEntertains/master
Hotfix 5, fix postgres arrays
This commit is contained in:
@@ -26,6 +26,7 @@ func GetObjectInfoByDataID(dataID types.UInt64) (datastore_types.DataStoreMetaIn
|
||||
|
||||
var createdDate time.Time
|
||||
var updatedDate time.Time
|
||||
var tagArray []string
|
||||
|
||||
err := database.Postgres.QueryRow(`SELECT
|
||||
data_id,
|
||||
@@ -58,7 +59,7 @@ func GetObjectInfoByDataID(dataID types.UInt64) (datastore_types.DataStoreMetaIn
|
||||
&metaInfo.Period,
|
||||
&metaInfo.ReferDataID,
|
||||
&metaInfo.Flag,
|
||||
pq.Array(&metaInfo.Tags),
|
||||
pq.Array(&tagArray),
|
||||
&createdDate,
|
||||
&updatedDate,
|
||||
)
|
||||
@@ -79,6 +80,11 @@ func GetObjectInfoByDataID(dataID types.UInt64) (datastore_types.DataStoreMetaIn
|
||||
return datastore_types.NewDataStoreMetaInfo(), nexError
|
||||
}
|
||||
|
||||
metaInfo.Tags = make(types.List[types.String], 0, len(tagArray))
|
||||
for i := range tagArray {
|
||||
metaInfo.Tags = append(metaInfo.Tags, types.String(tagArray[i]))
|
||||
}
|
||||
|
||||
metaInfo.Ratings = ratings
|
||||
|
||||
metaInfo.CreatedTime.FromTimestamp(createdDate)
|
||||
|
||||
@@ -26,6 +26,7 @@ func GetObjectInfoByDataIDWithPassword(dataID, password types.UInt64) (datastore
|
||||
|
||||
var createdDate time.Time
|
||||
var updatedDate time.Time
|
||||
var tagArray []string
|
||||
|
||||
err := database.Postgres.QueryRow(`SELECT
|
||||
data_id,
|
||||
@@ -58,7 +59,7 @@ func GetObjectInfoByDataIDWithPassword(dataID, password types.UInt64) (datastore
|
||||
&metaInfo.Period,
|
||||
&metaInfo.ReferDataID,
|
||||
&metaInfo.Flag,
|
||||
pq.Array(&metaInfo.Tags),
|
||||
pq.Array(&tagArray),
|
||||
&createdDate,
|
||||
&updatedDate,
|
||||
)
|
||||
@@ -78,6 +79,11 @@ func GetObjectInfoByDataIDWithPassword(dataID, password types.UInt64) (datastore
|
||||
return datastore_types.NewDataStoreMetaInfo(), nexError
|
||||
}
|
||||
|
||||
metaInfo.Tags = make(types.List[types.String], 0, len(tagArray))
|
||||
for i := range tagArray {
|
||||
metaInfo.Tags = append(metaInfo.Tags, types.String(tagArray[i]))
|
||||
}
|
||||
|
||||
metaInfo.Ratings = ratings
|
||||
|
||||
metaInfo.CreatedTime.FromTimestamp(createdDate)
|
||||
|
||||
@@ -23,6 +23,7 @@ func GetObjectInfoByPersistenceTargetWithPassword(persistenceTarget datastore_ty
|
||||
var underReview bool
|
||||
var createdDate time.Time
|
||||
var updatedDate time.Time
|
||||
var tagArray []string
|
||||
|
||||
err := database.Postgres.QueryRow(`SELECT
|
||||
data_id,
|
||||
@@ -57,7 +58,7 @@ func GetObjectInfoByPersistenceTargetWithPassword(persistenceTarget datastore_ty
|
||||
&metaInfo.Period,
|
||||
&metaInfo.ReferDataID,
|
||||
&metaInfo.Flag,
|
||||
pq.Array(&metaInfo.Tags),
|
||||
pq.Array(&tagArray),
|
||||
&createdDate,
|
||||
&updatedDate,
|
||||
&accessPassword,
|
||||
@@ -89,6 +90,11 @@ func GetObjectInfoByPersistenceTargetWithPassword(persistenceTarget datastore_ty
|
||||
return datastore_types.NewDataStoreMetaInfo(), nexError
|
||||
}
|
||||
|
||||
metaInfo.Tags = make(types.List[types.String], 0, len(tagArray))
|
||||
for i := range tagArray {
|
||||
metaInfo.Tags = append(metaInfo.Tags, types.String(tagArray[i]))
|
||||
}
|
||||
|
||||
metaInfo.Ratings = ratings
|
||||
|
||||
metaInfo.CreatedTime.FromTimestamp(createdDate)
|
||||
|
||||
@@ -14,6 +14,16 @@ import (
|
||||
func InitializeObjectByPreparePostParam(ownerPID types.PID, param datastore_types.DataStorePreparePostParam) (uint64, *nex.Error) {
|
||||
var dataID uint64
|
||||
|
||||
tagArray := make([]string, 0, len(param.Tags))
|
||||
for i := range param.Tags {
|
||||
tagArray = append(tagArray, string(param.Tags[i]))
|
||||
}
|
||||
|
||||
extraDataArray := make([]string, 0, len(param.ExtraData))
|
||||
for i := range param.Tags {
|
||||
extraDataArray = append(extraDataArray, string(param.ExtraData[i]))
|
||||
}
|
||||
|
||||
now := time.Now()
|
||||
err := database.Postgres.QueryRow(`INSERT INTO datastore.objects (
|
||||
owner,
|
||||
@@ -64,9 +74,9 @@ func InitializeObjectByPreparePostParam(ownerPID types.PID, param datastore_type
|
||||
param.Flag,
|
||||
param.Period,
|
||||
param.ReferDataID,
|
||||
pq.Array(param.Tags),
|
||||
pq.Array(tagArray),
|
||||
param.PersistenceInitParam.PersistenceSlotID, // TODO - Check param.PersistenceInitParam.DeleteLastObject?
|
||||
pq.Array(param.ExtraData),
|
||||
pq.Array(extraDataArray),
|
||||
now,
|
||||
now,
|
||||
).Scan(&dataID)
|
||||
|
||||
@@ -71,6 +71,7 @@ func GetRandomCoursesWithLimit(limit int) (types.List[datastore_super_mario_make
|
||||
|
||||
var createdDate time.Time
|
||||
var updatedDate time.Time
|
||||
var tagArray []string
|
||||
|
||||
err := rows.Scan(
|
||||
&course.MetaInfo.DataID,
|
||||
@@ -86,7 +87,7 @@ func GetRandomCoursesWithLimit(limit int) (types.List[datastore_super_mario_make
|
||||
&course.MetaInfo.Period,
|
||||
&course.MetaInfo.ReferDataID,
|
||||
&course.MetaInfo.Flag,
|
||||
pq.Array(&course.MetaInfo.Tags),
|
||||
pq.Array(&tagArray),
|
||||
&createdDate,
|
||||
&updatedDate,
|
||||
&course.Score,
|
||||
@@ -101,6 +102,11 @@ func GetRandomCoursesWithLimit(limit int) (types.List[datastore_super_mario_make
|
||||
return nil, nexError
|
||||
}
|
||||
|
||||
course.MetaInfo.Tags = make(types.List[types.String], 0, len(tagArray))
|
||||
for i := range tagArray {
|
||||
course.MetaInfo.Tags = append(course.MetaInfo.Tags, types.String(tagArray[i]))
|
||||
}
|
||||
|
||||
course.MetaInfo.Ratings = ratings
|
||||
|
||||
course.MetaInfo.CreatedTime.FromTimestamp(createdDate)
|
||||
|
||||
@@ -15,6 +15,15 @@ func InitializeObjectByAttachFileParam(ownerPID types.PID, param datastore_smm_t
|
||||
now := time.Now()
|
||||
|
||||
var dataID types.UInt64
|
||||
tagArray := make([]string, 0, len(param.PostParam.Tags))
|
||||
for i := range param.PostParam.Tags {
|
||||
tagArray = append(tagArray, string(param.PostParam.Tags[i]))
|
||||
}
|
||||
|
||||
extraDataArray := make([]string, 0, len(param.PostParam.ExtraData))
|
||||
for i := range param.PostParam.Tags {
|
||||
extraDataArray = append(extraDataArray, string(param.PostParam.ExtraData[i]))
|
||||
}
|
||||
|
||||
err := database.Postgres.QueryRow(`INSERT INTO datastore.objects (
|
||||
owner,
|
||||
@@ -65,9 +74,9 @@ func InitializeObjectByAttachFileParam(ownerPID types.PID, param datastore_smm_t
|
||||
param.PostParam.Flag,
|
||||
param.PostParam.Period,
|
||||
param.ReferDataID,
|
||||
pq.Array(param.PostParam.Tags),
|
||||
pq.Array(tagArray),
|
||||
param.PostParam.PersistenceInitParam.PersistenceSlotID, // TODO - Check param.PersistenceInitParam.DeleteLastObject?
|
||||
pq.Array(param.PostParam.ExtraData),
|
||||
pq.Array(extraDataArray),
|
||||
now,
|
||||
now,
|
||||
).Scan(&dataID)
|
||||
|
||||
Reference in New Issue
Block a user