【文件属性】:
文件名称:leetcode中国-short:URLshorteningservice.高性能短链接服务
文件大小:16KB
文件格式:ZIP
更新时间:2021-06-29 20:39:37
系统开源
leetcode中国短的
使用杂音散列函数。
URL
缩短服务。
用法
package
main
import
(
"fmt"
"github.com/golang/glog"
"github.com/googege/short"
"os"
)
var
(
path
=
"https://t.cn/"
longURL
=
"https://github.com/googege/GOFamily/blob/master/基础知识/算法/算法题/leetcode/1.md"
)
func
main
()
{
db
:=
short
.
NewMapDB
()
//
add
db
engine
to
short.
s
:=
short
.
NewShort
(
db
)
//
shortURL
,
err
:=
s
.
ShortAdd
(
longURL
)
if
err
!=
nil
{
glog
.
Error
(
【文件预览】:
short-master
----history.md(68B)
----go.mod(330B)
----.github()
--------workflows()
----db_test.go(744B)
----go.sum(11KB)
----db.go(1KB)
----base62()
--------base62.go(1KB)
--------base62_test.go(616B)
----short_test.go(14B)
----mysql_test.go(14B)
----example()
--------example.go(951B)
----mysql.go(2KB)
----LICENSE(1KB)
----redis.go(1KB)
----README.md(2KB)
----bloom()
--------bloom_test.go(465B)
--------bloom.go(345B)
----redis_test.go(14B)
----short.go(1KB)
----hash()
--------hash.go(235B)
----.gitignore(29B)
网友评论
- 跑不起来。。。