Coder Social home page Coder Social logo

key-value-go's Introduction

2023-Dcard-Intern

實作一個共用的 Key-Value 列表系統,用於 Dcard 的個人化推薦文章列。

工具 版本
Go 1.20
PostgreSQL 15.2
------ ------

功能如下:

  1. Golang 開發並設計 Restful API 。
  2. 執行 go test 即可執行 Integration Test
  3. 避免 storage 儲存太多,需要定期清除不用的內容。

Storage 選擇 - PostgreSQL

本身之前較常使用的是 Mysql,選擇PostgreSQL的原因有:

  • 数据类型: MySQL 和 PostgreSQL 支持的数据类型有所不同,PostgreSQL 支持更多的数据类型
  • 性能:MySQL 更适合处理大量的简单查询和事务,而 PostgreSQL 更适合处理复杂的查询和高并发的环境。

定期清除不用的內容

使用的是PostgreSQL 的 Time to Live 功能

  • TTL 功能可以讓 PostgreSQL 自動刪除超過一定時間限制的資料。
  • 需注意的是PostgreSQL 9.6以上才可以使用

UnitTest 測試

go test
go test -run TestGetHeadHandler
go test -run TestGetPageHandler
go test -run TestSetHandler

Test Result

key-value-go's People

Contributors

kolihhan avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.