Skip to content
This repository was archived by the owner on May 30, 2024. It is now read-only.

Commit 9cde065

Browse files
author
noah
committed
Add oss tag to the 'db.go' file
1 parent dbb783c commit 9cde065

File tree

3 files changed

+25
-2
lines changed

3 files changed

+25
-2
lines changed

LICENSE

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ software that would otherwise infringe either the contributor's
2020
copyright in it.
2121

2222
1. You must limit use of this software in any manner primarily
23-
intended for commercial advantage or private monetary compensation
24-
to the count of user limit.
23+
intended for commercial advantage or private monetary compensation.
2524
This limit does not apply to use in developing feedback or extensions
2625
that you contribute back to those giving this license.
2726

cmd/server/db.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
// Copyright 2021 Gitploy.IO Inc. All rights reserved.
2+
// Use of this source code is governed by the Gitploy Non-Commercial License
3+
// that can be found in the LICENSE file.
4+
5+
// +build !oss
6+
17
package main
28

39
import (

cmd/server/db_oss.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// +build oss
2+
3+
package main
4+
5+
import (
6+
"fmt"
7+
8+
"entgo.io/ent/dialect"
9+
"github.com/gitploy-io/gitploy/ent"
10+
)
11+
12+
func OpenDB(driver string, dsn string) (*ent.Client, error) {
13+
if driver != dialect.SQLite {
14+
return nil, fmt.Errorf("The driver have to be one of them: sqlite3, mysql, or postgres.")
15+
}
16+
17+
return ent.Open(driver, dsn)
18+
}

0 commit comments

Comments
 (0)