Compare commits

..

No commits in common. '26700f9f9ed54872ee8312e246f58f428862f390' and 'ddf955a6918c610956cd441308e636c25476ba06' have entirely different histories.

5
.gitignore vendored

@ -10,6 +10,8 @@
*.dylib
.idea
.idea/*
/.idea
/.idea/*
# Test binary, built with `go test -c`
*.test
@ -22,6 +24,9 @@
# Go workspace file
go.work
go_mqtt
go.mod
.idea/workspace.xml

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="Go" enabled="true" />
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/go_mqtt.iml" filepath="$PROJECT_DIR$/.idea/go_mqtt.iml" />
</modules>
</component>
</project>

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

@ -0,0 +1,113 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="AutoImportSettings">
<option name="autoReloadType" value="ALL" />
</component>
<component name="ChangeListManager">
<list default="true" id="9f8c3ce4-c378-4191-b7a4-3d5acbc0ebbc" name="Changes" comment="add goproxy">
<change beforePath="$PROJECT_DIR$/.gitignore" beforeDir="false" afterPath="$PROJECT_DIR$/.gitignore" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="FileTemplateManagerImpl">
<option name="RECENT_TEMPLATES">
<list>
<option value="Go File" />
</list>
</option>
</component>
<component name="GOROOT" url="file://$USER_HOME$/sdk_go/go1.24.1" />
<component name="Git.Pull.Settings">
<option name="OPTIONS">
<set>
<option value="REBASE" />
</set>
</option>
</component>
<component name="Git.Settings">
<option name="PUSH_TAGS">
<GitPushTagMode>
<option name="argument" value="--follow-tags" />
<option name="title" value="Current Branch" />
</GitPushTagMode>
</option>
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component>
<component name="GoLibraries">
<option name="indexEntireGoPath" value="false" />
</component>
<component name="ProjectId" id="2tfetVPzLbUsJUPlZCh055qVAGM" />
<component name="ProjectLevelVcsManager" settingsEditedManually="true" />
<component name="ProjectViewState">
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" />
</component>
<component name="PropertiesComponent">
<property name="ASKED_ADD_EXTERNAL_FILES" value="true" />
<property name="DefaultGoTemplateProperty" value="Go File" />
<property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
<property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
<property name="WebServerToolWindowFactoryState" value="false" />
<property name="configurable..is.expanded" value="false" />
<property name="configurable.GoLibrariesConfigurable.is.expanded" value="true" />
<property name="go.formatter.settings.were.checked" value="true" />
<property name="go.import.settings.migrated" value="true" />
<property name="go.modules.go.list.on.any.changes.was.set" value="true" />
<property name="go.sdk.automatically.set" value="true" />
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
<property name="settings.editor.selected.configurable" value="go.sdk" />
</component>
<component name="RecentsManager">
<key name="CopyFile.RECENT_KEYS">
<recent name="$PROJECT_DIR$" />
</key>
</component>
<component name="RunManager">
<configuration name="go build main.go" type="GoApplicationRunConfiguration" factoryName="Go Application" temporary="true" nameIsGenerated="true">
<module name="go_mqtt" />
<working_directory value="$PROJECT_DIR$" />
<kind value="FILE" />
<package value="go_mqtt" />
<directory value="$PROJECT_DIR$" />
<filePath value="$PROJECT_DIR$/main.go" />
<method v="2" />
</configuration>
<recent_temporary>
<list>
<item itemvalue="Go Build.go build main.go" />
</list>
</recent_temporary>
</component>
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
<component name="TypeScriptGeneratedFilesManager">
<option name="version" value="3" />
</component>
<component name="Vcs.Log.Tabs.Properties">
<option name="TAB_STATES">
<map>
<entry key="MAIN">
<value>
<State />
</value>
</entry>
</map>
</option>
<option name="oldMeFiltersMigrated" value="true" />
</component>
<component name="VcsManagerConfiguration">
<option name="ADD_EXTERNAL_FILES_SILENTLY" value="true" />
<MESSAGE value="数据库改用orm框架 gorm" />
<MESSAGE value="rr" />
<MESSAGE value="rrddf" />
<MESSAGE value="remove .idea" />
<MESSAGE value="add goproxy" />
<option name="LAST_COMMIT_MESSAGE" value="add goproxy" />
</component>
<component name="VgoProject">
<integration-enabled>true</integration-enabled>
</component>
</project>

@ -10,7 +10,6 @@ bee pack -be GOOSwindows GOARCH=amd64
bee pack -be GOOS=windows GOARCH=amd64
#go build打包方式
GOOS=windows GOARCH=amd64 go build
GOOS=linux GOARCH=amd64 go build

@ -2,21 +2,18 @@ module go_mqtt
go 1.24.1
require (
github.com/eclipse/paho.mqtt.golang v1.5.0
github.com/go-sql-driver/mysql v1.9.3
github.com/google/uuid v1.6.0
github.com/shopspring/decimal v1.4.0
gorm.io/driver/mysql v1.6.0
gorm.io/gorm v1.30.0
)
require (
filippo.io/edwards25519 v1.1.0 // indirect
github.com/eclipse/paho.mqtt.golang v1.5.0 // indirect
github.com/go-sql-driver/mysql v1.9.3 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/gorilla/websocket v1.5.3 // indirect
github.com/jinzhu/inflection v1.0.0 // indirect
github.com/jinzhu/now v1.1.5 // indirect
github.com/shopspring/decimal v1.4.0 // indirect
golang.org/x/net v0.41.0 // indirect
golang.org/x/sync v0.15.0 // indirect
golang.org/x/text v0.26.0 // indirect
gorm.io/driver/mysql v1.6.0 // indirect
gorm.io/gorm v1.30.0 // indirect
)

@ -1,12 +1,5 @@
#go1.24.1
#remove .idea in remote
#git rm -r --cached .idea
#git rm -r --cached lastupdate.tmp
#export GOPROXY=https://goproxy.io
#mysql driver
go get -u github.com/go-sql-driver/mysql
#uuid

@ -7,13 +7,13 @@ import (
)
type Temperature struct {
Id int64 `gorm:"primaryKey;autoIncrement"`
Id int64
CreateDate time.Time
DataDate string `gorm:"index:idx_dataDate;index:data_date_location_desc;size:20"`
DataHour string `gorm:"index:idx_dataHour;size:20"`
DataMinute string `gorm:"index:idx_dataMinute;size:20"`
DataDate string `gorm:"size:20"`
DataHour string `gorm:"size:20"`
DataMinute string `gorm:"size:20"`
Humidity string `gorm:"size:10"`
LocationDesc string `gorm:"index:idx_locationDesc;index:data_date_location_desc;size:80"`
LocationDesc string `gorm:"size:80"`
Temperature string `gorm:"size:10"`
Topic string `gorm:"size:60"`
}

@ -19,9 +19,8 @@ func initDatabase() {
//dsn := "root:Skyinno251,@tcp(192.168.2.18:3306)/gorm?charset=utf8mb4&parseTime=True&loc=Local"
//dsn := "root:Skyinno251,@tcp(47.242.184.139:3306)/appserver?charset=utf8mb4&parseTime=True&loc=Local"
//dsn := "root:Skyinno251,@tcp(localhost:3306)/appserver?charset=utf8mb4&parseTime=True&loc=Local"
dsn := "root:Skyinno251,@tcp(192.168.3.9:3306)/gorm?charset=utf8mb4&parseTime=True&loc=Local"
//dsn := "root:Skyinno251,@tcp(localhost:3306)/go_mqtt?charset=utf8mb4&parseTime=True&loc=Local"
dsn := "root:Skyinno251,@tcp(localhost:3306)/appserver?charset=utf8mb4&parseTime=True&loc=Local"
//dsn := "root:Skyinno251,@tcp(192.168.3.9:3306)/gorm?charset=utf8mb4&parseTime=True&loc=Local"
db, err := gorm.Open(mysql.New(mysql.Config{
DSN: dsn, // DSN data source name

Loading…
Cancel
Save