V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX  ›  XTTX  ›  全部回复第 21 页 / 共 29 页
回复总数  566
1 ... 13  14  15  16  17  18  19  20  21  22 ... 29  
2021-10-29 12:40:52 +08:00
回复了 imherer 创建的主题 Go 编程语言 关于 go 布尔默认值问题
// UpdateUser defines what information may be provided to modify an existing
// User. All fields are optional so clients can send just the fields they want
// changed. It uses pointer fields so we can differentiate between a field that
// was not provided and a field that was provided as explicitly blank. Normally
// we do not want to use pointers to basic types but we make exceptions around
// marshalling/unmarshalling.
type UpdateUser struct {
Username *string `json:"username"`
Email *string `json:"email" validate:"omitempty,email"`
Password *string `json:"password"`
PasswordConfirm *string `json:"passwordConfirm" validate:"omitempty,eqfield=Password"`
}
2021-10-25 14:36:48 +08:00
回复了 balabalaguguji 创建的主题 Go 编程语言 看到 Go 与 MongoDB 的交互方式,我想放弃 Go 了
从 mongoDB 和 Go 的不匹配到讨伐 Golang ,这出戏我见过了。每个语言都有自己存在的理由。用不用得习惯,适不适合自己的使用场景,得看自己。js 为了类型检查,搞出了 typescript. 都用习惯了就好了,没有完美的语言和工具
2021-10-25 11:43:17 +08:00
回复了 tiensonqin 创建的主题 酷工作 Logseq 远程招聘一位开发工程师 [40k ~ 65k]
@tiensonqin edsky2008*吗? 我还没有收到。 麻烦你了。
2021-10-25 10:57:53 +08:00
回复了 tiensonqin 创建的主题 酷工作 Logseq 远程招聘一位开发工程师 [40k ~ 65k]
@tiensonqin 如果方便,我很希望你能指出我简历的不足和你觉得的差距。“Oct 20, 2021, 4:27 PM” 发出, 我的邮箱结尾是 2008. 感谢
2021-10-24 23:45:50 +08:00
回复了 balabalaguguji 创建的主题 Go 编程语言 看到 Go 与 MongoDB 的交互方式,我想放弃 Go 了
不清楚为什么贴主一定要用 mongoDB 。Go 写 psql query 挺方便的,写多了都是 boilerplate, 改改就差不多了
2021-10-24 23:39:31 +08:00
回复了 balabalaguguji 创建的主题 Go 编程语言 看到 Go 与 MongoDB 的交互方式,我想放弃 Go 了
JS 写成 typescript ,要写各式各样的 type\interface\generics, 可不必 Go 写 struct 方便多少。
2021-10-24 22:31:53 +08:00
回复了 tiensonqin 创建的主题 酷工作 Logseq 远程招聘一位开发工程师 [40k ~ 65k]
@waytoexplorewhat 还是不要在别人的招聘贴里问这些东西。既然别人拿到了投资自然有对策。
2021-10-24 14:47:46 +08:00
回复了 balabalaguguji 创建的主题 Go 编程语言 看到 Go 与 MongoDB 的交互方式,我想放弃 Go 了
@Kisesy 我猜当初设计的时候,mongoDB 就是要做 data warehouse,所以必须读 ctx withTimeout 。mongoDB 的市场营销是所有 tech 里做得最好的, 让所有人都觉得其他人都在用 mongoDB 。 官网的文档那叫一个省事,复杂一点的查询方式根本不介绍。 当初我找查询的语法,真的找到吐血。
2021-10-24 13:39:57 +08:00
回复了 balabalaguguji 创建的主题 Go 编程语言 看到 Go 与 MongoDB 的交互方式,我想放弃 Go 了
````
//FindFinishedListArticleAction finds if articleAction exists by checking articleId and ownerID
func (aam *articleActionDB) FindFinishedListArticleAction(ownerID primitive.ObjectID) (*[]Article, error) {
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()

client, err := mongo.Connect(ctx, options.Client().ApplyURI(aam.connectionString))
if err != nil {
return nil, err
}
defer client.Disconnect(ctx)
collection := client.Database(aam.dataBaseName).Collection(aam.collectionName)
matchStage := bson.D{{"$match", bson.M{"ownerID": ownerID}}}
matchStage1 := bson.D{{"$match",
bson.M{"finisheddate": bson.M{"$exists": true}}}}
projectStage := bson.D{{"$project", bson.M{"articleID": 1}}}

type articleID struct {
ArticleID primitive.ObjectID `bson:"articleID"`
}

var articleIDs []articleID

cursor, err := collection.Aggregate(ctx, mongo.Pipeline{matchStage, matchStage1, projectStage})
if err != nil {
fmt.Println(err)
return nil, err
}
if err = cursor.All(ctx, &articleIDs); err != nil {
return nil, err
}
articleClient, err := mongo.Connect(ctx, options.Client().ApplyURI(aam.connectionString))
if err != nil {
return nil, err
}
defer articleClient.Disconnect(ctx)
articleCollection := client.Database("crawler").Collection("article")
var articles []Article
var article Article
for i := 0; i < len(articleIDs); i++ {
err := articleCollection.FindOne(ctx, bson.M{"_id": articleIDs[i].ArticleID}).Decode(&article)
if err != nil {
fmt.Println(err)
}
articles = append(articles, article)
}
return &articles, nil
}
````

这种东西写的难受, 看得更难受。
2021-10-24 13:34:26 +08:00
回复了 balabalaguguji 创建的主题 Go 编程语言 看到 Go 与 MongoDB 的交互方式,我想放弃 Go 了
//FindReadingListArticleAction finds if articleAction exists by checking articleId and ownerID
func (aam *articleActionDB) FindUserArticleActionArticle(ownerID primitive.ObjectID) (*[]Article, error) {
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()

client, err := mongo.Connect(ctx, options.Client().ApplyURI(aam.connectionString))
if err != nil {
return nil, err
}
defer client.Disconnect(ctx)
collection := client.Database(aam.dataBaseName).Collection(aam.collectionName)
matchStage := bson.D{{"$match", bson.M{"ownerID": ownerID}}}
projectStage := bson.D{{"$project", bson.M{"articleID": 1}}}

type articleID struct {
ArticleID primitive.ObjectID `bson:"articleID"`
}

var articleIDs []articleID

cursor, err := collection.Aggregate(ctx, mongo.Pipeline{matchStage, projectStage})
if err != nil {
fmt.Println(err)
return nil, err
}
if err = cursor.All(ctx, &articleIDs); err != nil {
return nil, err
}
articleClient, err := mongo.Connect(ctx, options.Client().ApplyURI(aam.connectionString))
if err != nil {
return nil, err
}
defer articleClient.Disconnect(ctx)
articleCollection := client.Database("crawler").Collection("article")
var articles []Article
var article Article
for i := 0; i < len(articleIDs); i++ {
err := articleCollection.FindOne(ctx, bson.M{"_id": articleIDs[i].ArticleID}).Decode(&article)
if err != nil {
fmt.Println(err)
}
articles = append(articles, article)
}
return &articles, nil
}

我 6 个月前写的,我现在完全看不懂当初写了什么寂寞
2021-10-24 13:33:26 +08:00
回复了 balabalaguguji 创建的主题 Go 编程语言 看到 Go 与 MongoDB 的交互方式,我想放弃 Go 了
官方 doc 就劝退了, 那你还是千万别用 go+mongoDB 了
2021-10-21 18:38:10 +08:00
回复了 XTTX 创建的主题 Go 编程语言 Golang 中的 web app error 处理
@NeroKamin 肯定不是啊。3.0 就要出了, 你找作者聊聊
你以为库克会害你吗?狗头。。。。。
@binbin0915 我说的是玩游戏
再置办个显卡。。。 继续划水。 不知道国内的 cloud ide 做得怎么样了,各大厂都再搞
2021-10-19 22:37:46 +08:00
回复了 kernel365 创建的主题 酷工作 [远程全职]全栈工程师(Vue, NodeJs, Python )
@darkengine 业务能力强啊。不过既然没有 Tech lead, 技术选型可以打破重来。
2021-10-19 20:11:24 +08:00
回复了 Canace 创建的主题 程序员 台式电脑有推荐的的吗
@wasd6267016 4 月左右的我用了 4 年的 1080ti 挂 5250 被秒了, 现在也就中正这种整机销售商能优先拿到好的价格了。
2021-10-19 20:01:09 +08:00
回复了 XTTX 创建的主题 求职 React,Golang 全栈求职
@mimang518 可以啊。 给个联系方式聊聊
2021-10-19 15:13:33 +08:00
回复了 Canace 创建的主题 程序员 台式电脑有推荐的的吗
@wasd6267016 8299,升级一下 cpu 或者价格 1tb 的 ssd 就到 1 万了。 显示器可以攒点钱买个 34 寸的 2k 。
2021-10-19 13:29:20 +08:00
回复了 Canace 创建的主题 程序员 台式电脑有推荐的的吗
@Deteriorator 今年的行情,自己组根本找不到价格合适的显卡。
1 ... 13  14  15  16  17  18  19  20  21  22 ... 29  
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   2500 人在线   最高记录 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 26ms · UTC 08:50 · PVG 16:50 · LAX 01:50 · JFK 04:50
Developed with CodeLauncher
♥ Do have faith in what you're doing.