吃点 oct 的抗敏药类似 开瑞坦 或者 zyrtec. 说吸鼻子的都是在胡说八道。。真的是胡说八道。 鼻腔内本身是稳定的环境,非要用外物刺激。 我常年鼻炎+慢性咽炎, 很多时候只能忍受。
vite 有自己的一套 proxy server, import env 和 absolute import. 我搞明白这三点,所有方面完胜 CRA, 除了有时候报错上有点怪怪的。就是白屏,要自己看 console.
@
EyebrowsWhite 我用类似 styled component 和 tailwind 比较多,什么场景下用 css module 比较多?
这不是 discord 么, 国内的翻版有 kaiheila, 还有腾讯在内测的 NokNok. 这个赛道突然火了啊。我挺好奇为啥 TapTap 不早点布局。
@
raaaaaar notion 实在是太方便了, 除了不能被 google 收录
自己写个 blog 的前端和后端, 还能同时练习各种技术栈。。。。
有这个闲工夫和钱和影响力,找 tailwind 合作,搞个合体不是美哉,何必走前人的路
@
imherer 这来自 ardanlab_service repo ,你在 github 里能搜到。强烈建议学习他的整个 repo 里的 pattern
// 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"`
}
从 mongoDB 和 Go 的不匹配到讨伐 Golang ,这出戏我见过了。每个语言都有自己存在的理由。用不用得习惯,适不适合自己的使用场景,得看自己。js 为了类型检查,搞出了 typescript. 都用习惯了就好了,没有完美的语言和工具
@
tiensonqin 如果方便,我很希望你能指出我简历的不足和你觉得的差距。“Oct 20, 2021, 4:27 PM” 发出, 我的邮箱结尾是 2008. 感谢
不清楚为什么贴主一定要用 mongoDB 。Go 写 psql query 挺方便的,写多了都是 boilerplate, 改改就差不多了
JS 写成 typescript ,要写各式各样的 type\interface\generics, 可不必 Go 写 struct 方便多少。
@
Kisesy 我猜当初设计的时候,mongoDB 就是要做 data warehouse,所以必须读 ctx withTimeout 。mongoDB 的市场营销是所有 tech 里做得最好的, 让所有人都觉得其他人都在用 mongoDB 。 官网的文档那叫一个省事,复杂一点的查询方式根本不介绍。 当初我找查询的语法,真的找到吐血。
````
//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
}
````
这种东西写的难受, 看得更难受。
//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 个月前写的,我现在完全看不懂当初写了什么寂寞
官方 doc 就劝退了, 那你还是千万别用 go+mongoDB 了