mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-10-31 21:28:11 +09:00 
			
		
		
		
	Added all required dependencies
This commit is contained in:
		
							
								
								
									
										37
									
								
								vendor/github.com/go-xorm/xorm/oci8_driver.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								vendor/github.com/go-xorm/xorm/oci8_driver.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,37 @@ | ||||
| // Copyright 2015 The Xorm Authors. All rights reserved. | ||||
| // Use of this source code is governed by a BSD-style | ||||
| // license that can be found in the LICENSE file. | ||||
|  | ||||
| package xorm | ||||
|  | ||||
| import ( | ||||
| 	"errors" | ||||
| 	"regexp" | ||||
|  | ||||
| 	"github.com/go-xorm/core" | ||||
| ) | ||||
|  | ||||
| type oci8Driver struct { | ||||
| } | ||||
|  | ||||
| //dataSourceName=user/password@ipv4:port/dbname | ||||
| //dataSourceName=user/password@[ipv6]:port/dbname | ||||
| func (p *oci8Driver) Parse(driverName, dataSourceName string) (*core.Uri, error) { | ||||
| 	db := &core.Uri{DbType: core.ORACLE} | ||||
| 	dsnPattern := regexp.MustCompile( | ||||
| 		`^(?P<user>.*)\/(?P<password>.*)@` + // user:password@ | ||||
| 			`(?P<net>.*)` + // ip:port | ||||
| 			`\/(?P<dbname>.*)`) // dbname | ||||
| 	matches := dsnPattern.FindStringSubmatch(dataSourceName) | ||||
| 	names := dsnPattern.SubexpNames() | ||||
| 	for i, match := range matches { | ||||
| 		switch names[i] { | ||||
| 		case "dbname": | ||||
| 			db.DbName = match | ||||
| 		} | ||||
| 	} | ||||
| 	if db.DbName == "" { | ||||
| 		return nil, errors.New("dbname is empty") | ||||
| 	} | ||||
| 	return db, nil | ||||
| } | ||||
		Reference in New Issue
	
	Block a user