随笔分类 -  Go

摘要:药品添加<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 青烟绕指柔 阅读(17) 评论(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 青烟绕指柔 阅读(82) 评论(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 青烟绕指柔 阅读(25) 评论(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 青烟绕指柔 阅读(52) 评论(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 青烟绕指柔 阅读(31) 评论(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 青烟绕指柔 阅读(177) 评论(0) 推荐(0)
摘要:package mainimport ( "errors" "fmt" "gorm.io/driver/mysql" "gorm.io/gorm")// DBConfig 定义一个DBConfig结构体,用于存储数据库连接的配置信息,包括主机地址、端口、用户名、密码和数据库名type DBConfi 阅读全文
posted @ 2023-10-18 08:30 青烟绕指柔 阅读(129) 评论(0) 推荐(0)
摘要:package main import "fmt" func main() { slice := []int{1, 2, 3, 4, 5} for k, v := range slice { if v == 4 { slice = append(slice[:k], slice[k+1:]...) 阅读全文
posted @ 2023-10-17 09:03 青烟绕指柔 阅读(48) 评论(0) 推荐(0)
摘要:package mainimport ( "encoding/json" "gorm.io/driver/mysql" "gorm.io/gorm" "net/http" "strconv")// 新闻结构体type News struct { Id int `json:"id"` Title st 阅读全文
posted @ 2023-09-28 11:14 青烟绕指柔 阅读(29) 评论(0) 推荐(0)