摘要: 定义config.yaml文件 mysql: driver: mysql user: root password: root host: 127.0.0.1 port: 8889 database: 2204a redis: addr: "127.0.0.1:6379" password: "" d 阅读全文
posted @ 2024-06-05 10:08 青烟绕指柔 阅读(5) 评论(0) 推荐(0) 编辑
摘要: 药品添加<template> <view class="content"> <view class="form-container"> <view class="form-item"> <label class="label">药品名称</label> <input type="text" clas 阅读全文
posted @ 2024-06-05 08:58 青烟绕指柔 阅读(2) 评论(0) 推荐(0) 编辑
摘要: package modelsimport "github.com/beego/beego/v2/client/orm"type Customer struct { Id int `orm:"pk;auto""` UserName string Sex string `orm:"size(5)"` M 阅读全文
posted @ 2024-05-11 19:19 青烟绕指柔 阅读(20) 评论(0) 推荐(0) 编辑
摘要: package main import ( "fmt" "gorm.io/driver/mysql" "gorm.io/gorm" "math/rand" "sync" "time" ) // 用户结构体 type User struct { Id int Name string Tel strin 阅读全文
posted @ 2023-12-28 14:44 青烟绕指柔 阅读(3) 评论(0) 推荐(0) 编辑
摘要: <!DOCTYPE html><html><head> <meta charset="utf8"> <style> .container { width: 400px; margin: 0 auto; padding: 20px; border: 1px solid #ccc; border-rad 阅读全文
posted @ 2023-12-26 20:57 青烟绕指柔 阅读(16) 评论(0) 推荐(0) 编辑
摘要: package main import ( "2112aGorm/models" "fmt" "gorm.io/driver/mysql" "gorm.io/gorm" "html/template" "io" "math" "net/http" "os" "strconv" ) var db *g 阅读全文
posted @ 2023-12-22 16:39 青烟绕指柔 阅读(4) 评论(0) 推荐(0) 编辑
摘要: package main import ( "encoding/json" "gorm.io/driver/mysql" "gorm.io/gorm" "math" "net/http" "strconv" ) // 封装接口返回的三要素:1状态 2提示 3数据 type ApiResponse s 阅读全文
posted @ 2023-10-28 10:03 青烟绕指柔 阅读(4) 评论(0) 推荐(0) 编辑
摘要: package main import ( "gorm.io/driver/mysql" "gorm.io/gorm" "html/template" "io" "math" "net/http" "os" "strconv" ) // 商品结构体 type Goods struct { Id in 阅读全文
posted @ 2023-10-27 17:02 青烟绕指柔 阅读(17) 评论(0) 推荐(0) 编辑
摘要: package singledb import ( "gorm.io/driver/mysql" "gorm.io/gorm" "sync" ) // 数据库连接对象只有一个 var ( db *gorm.DB Once sync.Once //只执行一次某个操作的机制 ) func GetDbIn 阅读全文
posted @ 2023-10-18 08:33 青烟绕指柔 阅读(77) 评论(0) 推荐(0) 编辑
摘要: package mainimport ( "errors" "fmt" "gorm.io/driver/mysql" "gorm.io/gorm")// DBConfig 定义一个DBConfig结构体,用于存储数据库连接的配置信息,包括主机地址、端口、用户名、密码和数据库名type DBConfi 阅读全文
posted @ 2023-10-18 08:30 青烟绕指柔 阅读(52) 评论(0) 推荐(0) 编辑